web/elements: fix copy on insecure origins (#4917)

* web/elements: fix copy on insecure origins

Signed-off-by: Jens Langhammer <jens@goauthentik.io>

* fallback to messages for other clipboard uses

Signed-off-by: Jens Langhammer <jens@goauthentik.io>

---------

Signed-off-by: Jens Langhammer <jens@goauthentik.io>
This commit is contained in:
Jens L
2023-03-13 14:18:48 +01:00
committed by GitHub
parent 9219abf84b
commit 61bf73d2f9
3 changed files with 43 additions and 0 deletions

View File

@ -82,6 +82,13 @@ export class AuthenticatorTOTPStage extends BaseStage<
@click=${(e: Event) => {
e.preventDefault();
if (!this.challenge?.configUrl) return;
if (!navigator.clipboard) {
showMessage({
level: MessageLevel.info,
message: this.challenge?.configUrl,
});
return;
}
navigator.clipboard
.writeText(this.challenge?.configUrl)
.then(() => {