web/flows: improve display of static tokens

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2021-11-04 15:21:04 +01:00
parent 3712d5aee2
commit 337677ad12
4 changed files with 30 additions and 25 deletions

View File

@ -22,21 +22,6 @@ import "../../../elements/forms/FormElement";
import "../../FormStatic"; import "../../FormStatic";
import { BaseStage } from "../base"; import { BaseStage } from "../base";
export const STATIC_TOKEN_STYLE = css`
/* Static OTP Tokens */
.ak-otp-tokens {
list-style: circle;
columns: 2;
-webkit-columns: 2;
-moz-columns: 2;
margin-left: var(--pf-global--spacer--xs);
}
.ak-otp-tokens li {
font-size: var(--pf-global--FontSize--2xl);
font-family: monospace;
}
`;
@customElement("ak-stage-authenticator-static") @customElement("ak-stage-authenticator-static")
export class AuthenticatorStaticStage extends BaseStage< export class AuthenticatorStaticStage extends BaseStage<
AuthenticatorStaticChallenge, AuthenticatorStaticChallenge,
@ -51,7 +36,21 @@ export class AuthenticatorStaticStage extends BaseStage<
PFTitle, PFTitle,
PFButton, PFButton,
AKGlobal, AKGlobal,
STATIC_TOKEN_STYLE, css`
/* Static OTP Tokens */
ul {
list-style: circle;
columns: 2;
-webkit-columns: 2;
-moz-columns: 2;
margin-left: var(--pf-global--spacer--xs);
}
ul li {
font-size: var(--pf-global--FontSize--2xl);
font-family: monospace;
margin: 0 2rem;
}
`,
]; ];
} }
@ -80,17 +79,14 @@ export class AuthenticatorStaticStage extends BaseStage<
> >
</div> </div>
</ak-form-static> </ak-form-static>
<ak-form-element <ak-form-element label="" class="pf-c-form__group">
label="${t`Tokens`}" <ul>
?required="${true}"
class="pf-c-form__group"
>
<ul class="ak-otp-tokens">
${this.challenge.codes.map((token) => { ${this.challenge.codes.map((token) => {
return html`<li>${token}</li>`; return html`<li>${token}</li>`;
})} })}
</ul> </ul>
</ak-form-element> </ak-form-element>
<p>${t`Make sure to keep these tokens in a safe place.`}</p>
<div class="pf-c-form__group pf-m-action"> <div class="pf-c-form__group pf-m-action">
<button type="submit" class="pf-c-button pf-m-primary pf-m-block"> <button type="submit" class="pf-c-button pf-m-primary pf-m-block">

View File

@ -2646,6 +2646,10 @@ msgstr "Long-running operations which authentik executes in the background."
msgid "MFA Devices" msgid "MFA Devices"
msgstr "MFA Devices" msgstr "MFA Devices"
#: src/flows/stages/authenticator_static/AuthenticatorStaticStage.ts
msgid "Make sure to keep these tokens in a safe place."
msgstr "Make sure to keep these tokens in a safe place."
#: src/pages/stages/user_write/UserWriteStageForm.ts #: src/pages/stages/user_write/UserWriteStageForm.ts
msgid "Mark newly created users as inactive." msgid "Mark newly created users as inactive."
msgstr "Mark newly created users as inactive." msgstr "Mark newly created users as inactive."
@ -4879,7 +4883,6 @@ msgstr "Token validity"
msgid "Token(s)" msgid "Token(s)"
msgstr "Token(s)" msgstr "Token(s)"
#: src/flows/stages/authenticator_static/AuthenticatorStaticStage.ts
#: src/pages/tokens/TokenListPage.ts #: src/pages/tokens/TokenListPage.ts
msgid "Tokens" msgid "Tokens"
msgstr "Tokens" msgstr "Tokens"

View File

@ -2627,6 +2627,10 @@ msgstr "Opérations de longue durée qu'Authentik exécute en arrière-plan."
msgid "MFA Devices" msgid "MFA Devices"
msgstr "" msgstr ""
#: src/flows/stages/authenticator_static/AuthenticatorStaticStage.ts
msgid "Make sure to keep these tokens in a safe place."
msgstr ""
#: src/pages/stages/user_write/UserWriteStageForm.ts #: src/pages/stages/user_write/UserWriteStageForm.ts
msgid "Mark newly created users as inactive." msgid "Mark newly created users as inactive."
msgstr "Marquer les utilisateurs nouvellements créés comme inactifs." msgstr "Marquer les utilisateurs nouvellements créés comme inactifs."
@ -4821,7 +4825,6 @@ msgstr "Validité du jeton"
msgid "Token(s)" msgid "Token(s)"
msgstr "Jeton(s)" msgstr "Jeton(s)"
#: src/flows/stages/authenticator_static/AuthenticatorStaticStage.ts
#: src/pages/tokens/TokenListPage.ts #: src/pages/tokens/TokenListPage.ts
msgid "Tokens" msgid "Tokens"
msgstr "Jetons" msgstr "Jetons"

View File

@ -2638,6 +2638,10 @@ msgstr ""
msgid "MFA Devices" msgid "MFA Devices"
msgstr "" msgstr ""
#: src/flows/stages/authenticator_static/AuthenticatorStaticStage.ts
msgid "Make sure to keep these tokens in a safe place."
msgstr ""
#: src/pages/stages/user_write/UserWriteStageForm.ts #: src/pages/stages/user_write/UserWriteStageForm.ts
msgid "Mark newly created users as inactive." msgid "Mark newly created users as inactive."
msgstr "" msgstr ""
@ -4864,7 +4868,6 @@ msgstr ""
msgid "Token(s)" msgid "Token(s)"
msgstr "" msgstr ""
#: src/flows/stages/authenticator_static/AuthenticatorStaticStage.ts
#: src/pages/tokens/TokenListPage.ts #: src/pages/tokens/TokenListPage.ts
msgid "Tokens" msgid "Tokens"
msgstr "" msgstr ""