1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-23 19:53:43 +00:00

support for unlocking with PIN code

This commit is contained in:
Kyle Spearrin
2019-02-12 23:53:04 -05:00
parent 7b395ba4ff
commit d5cbae7803
7 changed files with 80 additions and 7 deletions

View File

@@ -2,7 +2,7 @@
<header>
<div class="left"></div>
<div class="center">
<span class="title">{{'verifyMasterPassword' | i18n}}</span>
<span class="title">{{(pinLock ? 'verifyPin' : 'verifyMasterPassword') | i18n}}</span>
</div>
<div class="right">
<button type="submit" appBlurClick>{{'unlock' | i18n}}</button>
@@ -12,7 +12,12 @@
<div class="box">
<div class="box-content">
<div class="box-content-row box-content-row-flex" appBoxRow>
<div class="row-main">
<div class="row-main" *ngIf="pinLock">
<label for="pin">{{'pin' | i18n}}</label>
<input id="pin" type="{{showPassword ? 'text' : 'password'}}" name="PIN"
class="monospaced" [(ngModel)]="pin" required appInputVerbatim>
</div>
<div class="row-main" *ngIf="!pinLock">
<label for="masterPassword">{{'masterPass' | i18n}}</label>
<input id="masterPassword" type="{{showPassword ? 'text' : 'password'}}" name="MasterPassword"
class="monospaced" [(ngModel)]="masterPassword" required appInputVerbatim>
@@ -27,7 +32,7 @@
</div>
</div>
<div class="box-footer">
<p>{{'yourVaultIsLocked' | i18n}}</p>
<p>{{(pinLock ? 'yourVaultIsLockedPinCode' : 'yourVaultIsLocked') | i18n}}</p>
{{'loggedInAs' | i18n : email}}
</div>
</div>

View File

@@ -3,8 +3,10 @@ import { Router } from '@angular/router';
import { CryptoService } from 'jslib/abstractions/crypto.service';
import { I18nService } from 'jslib/abstractions/i18n.service';
import { LockService } from 'jslib/abstractions/lock.service';
import { MessagingService } from 'jslib/abstractions/messaging.service';
import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service';
import { StorageService } from 'jslib/abstractions/storage.service';
import { UserService } from 'jslib/abstractions/user.service';
import { LockComponent as BaseLockComponent } from 'jslib/angular/components/lock.component';
@@ -16,15 +18,17 @@ import { LockComponent as BaseLockComponent } from 'jslib/angular/components/loc
export class LockComponent extends BaseLockComponent {
constructor(router: Router, i18nService: I18nService,
platformUtilsService: PlatformUtilsService, messagingService: MessagingService,
userService: UserService, cryptoService: CryptoService) {
super(router, i18nService, platformUtilsService, messagingService, userService, cryptoService);
userService: UserService, cryptoService: CryptoService,
storageService: StorageService, lockService: LockService) {
super(router, i18nService, platformUtilsService, messagingService, userService, cryptoService,
storageService, lockService);
this.successRoute = '/tabs/current';
}
async ngOnInit() {
await super.ngOnInit();
window.setTimeout(() => {
document.getElementById('masterPassword').focus();
document.getElementById(this.pinLock ? 'pin' : 'masterPassword').focus();
}, 100);
}
}