Fix WebAuthn dialog not resetting on success (#910)

This commit is contained in:
Oscar Hinton 2021-04-05 22:37:02 +02:00 committed by GitHub
parent b28eaa1aae
commit 12e4b614f5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 0 deletions

View File

@ -103,6 +103,7 @@ async function initWebAuthn(obj: any) {
function error(message: string) {
const el = document.getElementById('msg');
resetMsgBox(el);
el.innerHTML = message;
el.classList.add('alert');
el.classList.add('alert-danger');
@ -112,7 +113,14 @@ function success(message: string) {
(document.getElementById('webauthn-button') as HTMLButtonElement).disabled = true;
const el = document.getElementById('msg');
resetMsgBox(el);
el.innerHTML = message;
el.classList.add('alert');
el.classList.add('alert-success');
}
function resetMsgBox(el: HTMLElement) {
el.classList.remove('alert');
el.classList.remove('alert-danger');
el.classList.remove('alert-success');
}