parent
fbf2fe2404
commit
74b407ebc7
|
@ -5,6 +5,7 @@ import { COMMON_STYLES } from "../../../common/styles";
|
|||
import { BaseStage } from "../base";
|
||||
import "webcomponent-qr-code";
|
||||
import "../form";
|
||||
import { showMessage } from "../../messages/MessageContainer";
|
||||
|
||||
export interface AuthenticatorTOTPChallenge extends WithUserInfoChallenge {
|
||||
config_url: string;
|
||||
|
@ -45,6 +46,19 @@ export class AuthenticatorTOTPStage extends BaseStage {
|
|||
<ak-form-element>
|
||||
<!-- @ts-ignore -->
|
||||
<qr-code data="${this.challenge.config_url}"></qr-code>
|
||||
<button class="pf-c-button pf-m-secondary pf-m-progress pf-m-in-progress" @click=${(e: Event) => {
|
||||
e.preventDefault();
|
||||
if (!this.challenge?.config_url) return;
|
||||
navigator.clipboard.writeText(this.challenge?.config_url).then(() => {
|
||||
showMessage({
|
||||
level_tag: "success",
|
||||
message: gettext("Successfully copied TOTP Config.")
|
||||
});
|
||||
});
|
||||
}}>
|
||||
<span class="pf-c-button__progress"><i class="fas fa-copy"></i></span>
|
||||
${gettext("Copy")}
|
||||
</button>
|
||||
</ak-form-element>
|
||||
<ak-form-element
|
||||
label="${gettext("Code")}"
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { customElement, LitElement, CSSResult, property } from "lit-element";
|
||||
import { customElement, LitElement, CSSResult, property, css } from "lit-element";
|
||||
import { TemplateResult, html } from "lit-html";
|
||||
import { Error } from "../../api/Flows";
|
||||
import { COMMON_STYLES } from "../../common/styles";
|
||||
|
@ -7,7 +7,16 @@ import { COMMON_STYLES } from "../../common/styles";
|
|||
export class FormElement extends LitElement {
|
||||
|
||||
static get styles(): CSSResult[] {
|
||||
return COMMON_STYLES;
|
||||
return COMMON_STYLES.concat(
|
||||
css`
|
||||
slot {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
justify-content: space-around;
|
||||
}
|
||||
`
|
||||
);
|
||||
}
|
||||
|
||||
@property()
|
||||
|
|
Reference in New Issue