toggle password on unlock page

This commit is contained in:
Kyle Spearrin 2018-02-24 13:48:55 -05:00
parent 40e135a297
commit 8e519f5518
2 changed files with 20 additions and 4 deletions

View File

@ -4,10 +4,19 @@
<p>{{'yourVaultIsLocked' | i18n}}</p>
<div class="box last">
<div class="box-content">
<div class="box-content-row" appBoxRow>
<label for="masterPassword">{{'masterPass' | i18n}}</label>
<input id="masterPassword" type="password" name="MasterPassword" [(ngModel)]="masterPassword"
required appAutofocus>
<div class="box-content-row box-content-row-flex" appBoxRow>
<div class="row-main">
<label for="masterPassword">{{'masterPass' | i18n}}</label>
<input id="masterPassword" type="{{showPassword ? 'text' : 'password'}}" name="MasterPassword"
class="monospaced" [(ngModel)]="masterPassword" required appAutofocus>
</div>
<div class="action-buttons">
<a class="row-btn" href="#" appStopClick appBlurClick
title="{{'toggleVisibility' | i18n}}" (click)="togglePassword()">
<i class="fa fa-lg"
[ngClass]="{'fa-eye': !showPassword, 'fa-eye-slash': showPassword}"></i>
</a>
</div>
</div>
</div>
</div>

View File

@ -18,6 +18,7 @@ import { UserService } from 'jslib/abstractions/user.service';
})
export class LockComponent {
masterPassword: string = '';
showPassword: boolean = false;
constructor(private router: Router, private analytics: Angulartics2,
private toasterService: ToasterService, private i18nService: I18nService,
@ -53,4 +54,10 @@ export class LockComponent {
this.messagingService.send('logout');
}
}
togglePassword() {
this.analytics.eventTrack.next({ action: 'Toggled Master Password on Unlock' });
this.showPassword = !this.showPassword;
document.getElementById('masterPassword').focus();
}
}