web/flows: improve layout for TOTP QR stage

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2022-07-28 21:16:39 +02:00
parent 0248755cda
commit e49050af19
1 changed files with 41 additions and 22 deletions

View File

@ -8,7 +8,7 @@ import "webcomponent-qr-code";
import { t } from "@lingui/macro"; import { t } from "@lingui/macro";
import { CSSResult, TemplateResult, html } from "lit"; import { CSSResult, TemplateResult, css, html } from "lit";
import { customElement } from "lit/decorators.js"; import { customElement } from "lit/decorators.js";
import { ifDefined } from "lit/directives/if-defined.js"; import { ifDefined } from "lit/directives/if-defined.js";
@ -31,7 +31,22 @@ export class AuthenticatorTOTPStage extends BaseStage<
AuthenticatorTOTPChallengeResponseRequest AuthenticatorTOTPChallengeResponseRequest
> { > {
static get styles(): CSSResult[] { static get styles(): CSSResult[] {
return [PFBase, PFLogin, PFForm, PFFormControl, PFTitle, PFButton, AKGlobal]; return [
PFBase,
PFLogin,
PFForm,
PFFormControl,
PFTitle,
PFButton,
AKGlobal,
css`
.qr-container {
display: flex;
flex-direction: column;
place-items: center;
}
`,
];
} }
render(): TemplateResult { render(): TemplateResult {
@ -61,6 +76,7 @@ export class AuthenticatorTOTPStage extends BaseStage<
</ak-form-static> </ak-form-static>
<input type="hidden" name="otp_uri" value=${this.challenge.configUrl} /> <input type="hidden" name="otp_uri" value=${this.challenge.configUrl} />
<ak-form-element> <ak-form-element>
<div class="qr-container">
<!-- @ts-ignore --> <!-- @ts-ignore -->
<qr-code data="${this.challenge.configUrl}"></qr-code> <qr-code data="${this.challenge.configUrl}"></qr-code>
<button <button
@ -79,9 +95,12 @@ export class AuthenticatorTOTPStage extends BaseStage<
}); });
}} }}
> >
<span class="pf-c-button__progress"><i class="fas fa-copy"></i></span> <span class="pf-c-button__progress"
><i class="fas fa-copy"></i
></span>
${t`Copy`} ${t`Copy`}
</button> </button>
</div>
</ak-form-element> </ak-form-element>
<ak-form-element <ak-form-element
label="${t`Code`}" label="${t`Code`}"