Add unlock using biometry to lock screen

This commit is contained in:
Hinton 2020-10-11 20:42:09 +02:00
parent f311101ed9
commit 01ffa27fcc
2 changed files with 28 additions and 0 deletions

View File

@ -36,6 +36,11 @@
{{'loggedInAsOn' | i18n : email : webVaultHostname}}
</div>
</div>
<div class="box" *ngIf="biometricLock">
<div class="box-footer">
<a class="btn primary block" (click)="unlockBiometric()">Unlock with biometry</a>
</div>
</div>
<p class="text-center">
<a href="#" appStopClick (click)="logOut()">{{'logOut' | i18n}}</a>
</p>

View File

@ -13,6 +13,7 @@ import { UserService } from 'jslib/abstractions/user.service';
import { VaultTimeoutService } from 'jslib/abstractions/vaultTimeout.service';
import { LockComponent as BaseLockComponent } from 'jslib/angular/components/lock.component';
import Swal from 'sweetalert2';
@Component({
selector: 'app-lock',
@ -36,4 +37,26 @@ export class LockComponent extends BaseLockComponent {
document.getElementById(this.pinLock ? 'pin' : 'masterPassword').focus();
}, 100);
}
async unlockBiometric() {
if (!this.biometricLock) {
return;
}
const div = document.createElement('div');
div.innerHTML = `<div class="swal2-text">${this.i18nService.t('awaitDesktop')}</div>`;
const submitted = Swal.fire({
heightAuto: false,
buttonsStyling: false,
html: div,
showCancelButton: true,
cancelButtonText: this.i18nService.t('cancel'),
showConfirmButton: false,
});
await super.unlockBiometric();
Swal.close();
}
}