2019-01-08 05:29:50 +01:00
|
|
|
import { Component } from '@angular/core';
|
2018-04-05 04:59:42 +02:00
|
|
|
import { Router } from '@angular/router';
|
|
|
|
|
2021-06-07 19:25:37 +02:00
|
|
|
import { ApiService } from 'jslib-common/abstractions/api.service';
|
|
|
|
import { CryptoService } from 'jslib-common/abstractions/crypto.service';
|
|
|
|
import { EnvironmentService } from 'jslib-common/abstractions/environment.service';
|
|
|
|
import { I18nService } from 'jslib-common/abstractions/i18n.service';
|
|
|
|
import { MessagingService } from 'jslib-common/abstractions/messaging.service';
|
|
|
|
import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service';
|
|
|
|
import { StateService } from 'jslib-common/abstractions/state.service';
|
|
|
|
import { StorageService } from 'jslib-common/abstractions/storage.service';
|
|
|
|
import { UserService } from 'jslib-common/abstractions/user.service';
|
|
|
|
import { VaultTimeoutService } from 'jslib-common/abstractions/vaultTimeout.service';
|
2018-04-05 04:59:42 +02:00
|
|
|
|
2021-06-07 19:25:37 +02:00
|
|
|
import { LockComponent as BaseLockComponent } from 'jslib-angular/components/lock.component';
|
2020-10-11 20:42:09 +02:00
|
|
|
import Swal from 'sweetalert2';
|
2018-04-05 04:59:42 +02:00
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: 'app-lock',
|
2018-04-06 17:48:45 +02:00
|
|
|
templateUrl: 'lock.component.html',
|
2018-04-05 04:59:42 +02:00
|
|
|
})
|
2019-01-08 05:29:50 +01:00
|
|
|
export class LockComponent extends BaseLockComponent {
|
2018-10-03 06:21:22 +02:00
|
|
|
constructor(router: Router, i18nService: I18nService,
|
2018-04-05 04:59:42 +02:00
|
|
|
platformUtilsService: PlatformUtilsService, messagingService: MessagingService,
|
2019-02-13 05:53:04 +01:00
|
|
|
userService: UserService, cryptoService: CryptoService,
|
2020-04-06 17:40:16 +02:00
|
|
|
storageService: StorageService, vaultTimeoutService: VaultTimeoutService,
|
2020-07-29 23:01:05 +02:00
|
|
|
environmentService: EnvironmentService, stateService: StateService,
|
|
|
|
apiService: ApiService) {
|
2019-02-13 05:53:04 +01:00
|
|
|
super(router, i18nService, platformUtilsService, messagingService, userService, cryptoService,
|
2020-07-29 23:01:05 +02:00
|
|
|
storageService, vaultTimeoutService, environmentService, stateService, apiService);
|
2018-04-05 04:59:42 +02:00
|
|
|
this.successRoute = '/tabs/current';
|
|
|
|
}
|
2018-04-19 17:17:07 +02:00
|
|
|
|
2019-01-08 05:29:50 +01:00
|
|
|
async ngOnInit() {
|
|
|
|
await super.ngOnInit();
|
2018-04-19 17:17:07 +02:00
|
|
|
window.setTimeout(() => {
|
2019-02-13 05:53:04 +01:00
|
|
|
document.getElementById(this.pinLock ? 'pin' : 'masterPassword').focus();
|
2018-04-19 17:17:07 +02:00
|
|
|
}, 100);
|
|
|
|
}
|
2020-10-11 20:42:09 +02:00
|
|
|
|
|
|
|
async unlockBiometric() {
|
|
|
|
if (!this.biometricLock) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
const div = document.createElement('div');
|
|
|
|
div.innerHTML = `<div class="swal2-text">${this.i18nService.t('awaitDesktop')}</div>`;
|
|
|
|
|
2020-10-21 17:18:04 +02:00
|
|
|
Swal.fire({
|
2020-10-11 20:42:09 +02:00
|
|
|
heightAuto: false,
|
|
|
|
buttonsStyling: false,
|
|
|
|
html: div,
|
|
|
|
showCancelButton: true,
|
|
|
|
cancelButtonText: this.i18nService.t('cancel'),
|
|
|
|
showConfirmButton: false,
|
|
|
|
});
|
|
|
|
|
|
|
|
await super.unlockBiometric();
|
|
|
|
|
|
|
|
Swal.close();
|
|
|
|
}
|
2018-04-05 04:59:42 +02:00
|
|
|
}
|