ui/provide otp (#8630)

* show OTP if there is one, otherwise show placeholder

* show OTP during first step of token generation process

* use let instead of with
This commit is contained in:
Noelle Daley 2020-03-30 17:36:49 -07:00 committed by GitHub
parent b6f8fcb164
commit 015114f61e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -4,11 +4,7 @@
<HoverCopyButton @copyValue={{encoded_token}} /> <HoverCopyButton @copyValue={{encoded_token}} />
<div class="message-body"> <div class="message-body">
<h4 class="title is-7 is-marginless"> <h4 class="title is-7 is-marginless">
{{#if otp}} Encoded Operation Token
Encoded Operation Token
{{else}}
Encrypted Operation Token
{{/if}}
</h4> </h4>
<code class="is-word-break">{{encoded_token}}</code> <code class="is-word-break">{{encoded_token}}</code>
</div> </div>
@ -23,10 +19,10 @@
<code class="is-word-break">{{otp}}</code> <code class="is-word-break">{{otp}}</code>
</div> </div>
</div> </div>
{{/if}}
<div class="message is-list has-copy-button" tabindex="-1"> <div class="message is-list has-copy-button" tabindex="-1">
{{#let {{#let (if otp
(concat 'vault operator generate-root -dr-token -otp="' otp '" -decode="' encoded_token '"') (concat 'vault operator generate-root -otp="' otp '" -decode="' encoded_token '"') (concat 'vault operator generate-root -otp="<enter your otp here>" -decode="' encoded_token '"') ) as |cmd|}}
as |cmd|}}
<HoverCopyButton @copyValue={{cmd}} /> <HoverCopyButton @copyValue={{cmd}} />
<div class="message-body"> <div class="message-body">
<h4 class="title is-7 is-marginless"> <h4 class="title is-7 is-marginless">
@ -36,7 +32,6 @@
</div> </div>
{{/let}} {{/let}}
</div> </div>
{{/if}}
</div> </div>
<div class="box is-marginless is-shadowless"> <div class="box is-marginless is-shadowless">
<button type="button" class="button" {{action 'reset'}}> <button type="button" class="button" {{action 'reset'}}>
@ -131,6 +126,20 @@
</div> </div>
{{/if}} {{/if}}
<div class="box is-shadowless is-marginless no-padding-top is-fullwidth" data-test-form-text> <div class="box is-shadowless is-marginless no-padding-top is-fullwidth" data-test-form-text>
{{#if otp}}
<p>
<AlertBanner @type="info" @message="Below is the generated OTP. This will be used to encode the generated Operation Token. Make sure to save this, as you will need it later to decode the Operation Token." />
</p>
<div class="message is-list has-copy-button" tabindex="-1">
<HoverCopyButton @copyValue={{otp}} />
<div class="message-body">
<h4 class="title is-7 is-marginless">
One Time Password (otp)
</h4>
<code class="is-word-break">{{otp}}</code>
</div>
</div>
{{/if}}
{{#if (has-block)}} {{#if (has-block)}}
{{yield}} {{yield}}
{{else if formText}} {{else if formText}}