610fe599c2
* use the OTP that the server provides instead of generating one in the JS client * fix button styling * differentiate between OTP and encoded token and encrypted token in the template
173 lines
6.1 KiB
Handlebars
173 lines
6.1 KiB
Handlebars
{{#if encoded_token}}
|
|
<div class="box is-marginless is-shadowless">
|
|
<div class="message is-list has-copy-button" tabindex="-1">
|
|
<HoverCopyButton @copyValue={{encoded_token}} />
|
|
<div class="message-body">
|
|
<h4 class="title is-7 is-marginless">
|
|
{{#if otp}}
|
|
Encoded Operation Token
|
|
{{else}}
|
|
Encrypted Operation Token
|
|
{{/if}}
|
|
</h4>
|
|
<code class="is-word-break">{{encoded_token}}</code>
|
|
</div>
|
|
</div>
|
|
{{#if otp}}
|
|
<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>
|
|
<div class="message is-list has-copy-button" tabindex="-1">
|
|
{{#let
|
|
(concat 'vault operator generate-root -otp="' otp '" -decode="' encoded_token '"')
|
|
as |cmd|}}
|
|
<HoverCopyButton @copyValue={{cmd}} />
|
|
<div class="message-body">
|
|
<h4 class="title is-7 is-marginless">
|
|
DR Operation Token Command
|
|
</h4>
|
|
<code class="is-word-break">{{cmd}}</code>
|
|
</div>
|
|
{{/let}}
|
|
</div>
|
|
{{/if}}
|
|
</div>
|
|
<div class="box is-marginless is-shadowless">
|
|
<button type="button" class="button" {{action 'reset'}}>
|
|
Clear Token
|
|
</button>
|
|
</div>
|
|
{{else if (and generateAction (not started))}}
|
|
<form {{action 'startGenerate' (hash pgp_key=pgp_key) on="submit"}} id="shamir">
|
|
{{message-error errors=errors}}
|
|
{{#if (eq generateStep 'chooseMethod')}}
|
|
<div class="box is-marginless is-shadowless">
|
|
<p>
|
|
Updating or promoting this cluster requires an operation token. Let's generate one by
|
|
inputting the master key shares. If you'd like to encrypt the token with a PGP Key, please click "Provide PGP Key" below, otherwise we can begin generation of the Operation Token.
|
|
</p>
|
|
</div>
|
|
<div class="box is-shadowless field is-grouped is-grouped-centered">
|
|
<div class="control">
|
|
<button type="button" class="button is-primary" {{action (mut generateWithPGP) true}}>
|
|
Provide PGP Key
|
|
</button>
|
|
</div>
|
|
<div class="control">
|
|
<span class="button auto-width is-white is-static">
|
|
or
|
|
</span>
|
|
</div>
|
|
<div class="control">
|
|
<button type="submit" class="button is-primary">
|
|
Generate Operation Token
|
|
</button>
|
|
</div>
|
|
</div>
|
|
{{/if}}
|
|
{{#if (eq generateStep 'providePGPKey')}}
|
|
<div class="box is-marginless is-shadowless">
|
|
<p>
|
|
Choose a PGP Key from your computer or paste the contents of one in the form below.
|
|
This key will be used to Encrypt the generated Operation Token.
|
|
</p>
|
|
{{pgp-file index='' key=pgpKeyFile onChange=(action 'setKey')}}
|
|
</div>
|
|
<div class="field is-grouped box is-marginless is-shadowless">
|
|
<div class="control">
|
|
<button type="button" class="button" {{action "reset"}}>
|
|
Back
|
|
</button>
|
|
</div>
|
|
<div class="control">
|
|
<button type="button" disabled={{not pgp_key}} class="button is-primary" {{action "savePGPKey"}}>
|
|
Use PGP Key
|
|
</button>
|
|
</div>
|
|
</div>
|
|
{{/if}}
|
|
{{#if (eq generateStep 'beginGenerationWithPGP')}}
|
|
<div class="box is-marginless is-shadowless">
|
|
<p>
|
|
Below is the base-64 encoded PGP Key that will be used to encrypt the generated Operation Token.
|
|
Next we'll enter portions of the master key to generate an Operation Token. Click the "Generate Operation Token" button to proceed.
|
|
</p>
|
|
<div class="message is-list has-copy-button" tabindex="-1">
|
|
<HoverCopyButton @copyValue={{pgp_key}} />
|
|
<div class="message-body">
|
|
<h4 class="title is-7 is-marginless">
|
|
PGP Key {{pgpKeyFile.fileName}}
|
|
</h4>
|
|
<code class="is-word-break">{{pgp_key}}</code>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="field is-grouped box is-marginless is-shadowless">
|
|
<div class="control">
|
|
<button type="button" class="button" {{action "reset"}}>
|
|
Back
|
|
</button>
|
|
</div>
|
|
<div class="control">
|
|
<button type="submit" disabled={{and (not pgp_key)}} class="button is-primary">
|
|
Generate Operation Token
|
|
</button>
|
|
</div>
|
|
</div>
|
|
{{/if}}
|
|
</form>
|
|
{{else}}
|
|
<form {{action 'onSubmit' (hash key=key) on="submit"}} id="shamir">
|
|
<div class="box is-marginless is-shadowless">
|
|
{{#if errors}}
|
|
<div class="box is-shadowless is-marginless no-padding-top is-fullwidth">
|
|
{{message-error errors=errors}}
|
|
</div>
|
|
{{/if}}
|
|
<div class="box is-shadowless is-marginless no-padding-top is-fullwidth" data-test-form-text>
|
|
{{#if hasBlock}}
|
|
{{yield}}
|
|
{{else if formText}}
|
|
{{formText}}
|
|
{{/if}}
|
|
</div>
|
|
<div class="field">
|
|
<label for="key" class="is-label">
|
|
Master Key Portion
|
|
</label>
|
|
<div class="control">
|
|
{{input class="input"type="password" name="key" value=key data-test-shamir-input=true}}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="box is-marginless is-shadowless">
|
|
<div class="columns is-mobile">
|
|
<div class="column is-narrow">
|
|
<button
|
|
type="submit"
|
|
class="button is-primary"
|
|
disabled={{loading}}
|
|
data-test-shamir-submit=true
|
|
>
|
|
{{if generateAction "Generate Token" buttonText}}
|
|
</button>
|
|
</div>
|
|
<div class="column is-flex-v-centered is-flex-end">
|
|
{{#if (or started hasProgress)}}
|
|
<ShamirProgress
|
|
@threshold={{threshold}}
|
|
@progress={{progress}}
|
|
/>
|
|
{{/if}}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
{{/if}}
|