1
0
mirror of https://github.com/bitwarden/browser synced 2024-12-26 09:54:35 +01:00

Add support for hidden password

This commit is contained in:
hinton 2020-05-24 19:59:49 +02:00
parent ae5dbbd267
commit 5e4259db38
5 changed files with 19 additions and 9 deletions

View File

@ -577,7 +577,7 @@ export default class MainBackground {
});
}
if (cipher == null || (cipher.login.password && cipher.login.password !== '')) {
if (cipher == null || (cipher.login.password && cipher.login.password !== '' && cipher.viewPassword)) {
await this.contextMenusCreate({
type: 'normal',
id: 'copy-password_' + idSuffix,

View File

@ -13,7 +13,7 @@
</span>
<span class="row-btn" appStopClick appStopProp appA11yTitle="{{'copyPassword' | i18n}}"
(click)="copy(cipher, cipher.login.password, 'password', 'Password')"
[ngClass]="{disabled: !cipher.login.password}">
[ngClass]="{disabled: (!cipher.login.password || !cipher.viewPassword)}">
<i class="fa fa-lg fa-key" aria-hidden="true"></i>
</span>
</ng-container>

View File

@ -53,6 +53,10 @@ export class ActionButtonsComponent {
return;
}
if (!cipher.viewPassword) {
return;
}
this.analytics.eventTrack.next({ action: 'Copied ' + aType });
this.platformUtilsService.copyToClipboard(value, { window: window });
this.toasterService.popAsync('info', null,

View File

@ -40,24 +40,28 @@
<div class="row-main">
<label for="loginPassword">{{'password' | i18n}}</label>
<input id="loginPassword" class="monospaced" type="{{showPassword ? 'text' : 'password'}}"
name="Login.Password" [(ngModel)]="cipher.login.password" appInputVerbatim>
name="Login.Password" [(ngModel)]="cipher.login.password" appInputVerbatim
[disabled]="!cipher.viewPassword">
</div>
<div class="action-buttons">
<button type="button" #checkPasswordBtn class="row-btn btn" appBlurClick
appA11yTitle="{{'checkPassword' | i18n}}" (click)="checkPassword()"
[appApiAction]="checkPasswordPromise" [disabled]="checkPasswordBtn.loading">
[appApiAction]="checkPasswordPromise" [disabled]="checkPasswordBtn.loading"
*ngIf="cipher.viewPassword">
<i class="fa fa-lg fa-check-circle" [hidden]="checkPasswordBtn.loading"
aria-hidden="true"></i>
<i class="fa fa-lg fa-spinner fa-spin" [hidden]="!checkPasswordBtn.loading"
aria-hidden="true"></i>
</button>
<a class="row-btn" href="#" appStopClick appBlurClick
appA11yTitle="{{'toggleVisibility' | i18n}}" (click)="togglePassword()">
appA11yTitle="{{'toggleVisibility' | i18n}}" (click)="togglePassword()"
*ngIf="cipher.viewPassword">
<i class="fa fa-lg" aria-hidden="true"
[ngClass]="{'fa-eye': !showPassword, 'fa-eye-slash': showPassword}"></i>
</a>
<a class="row-btn" href="#" appStopClick appBlurClick
appA11yTitle="{{'generatePassword' | i18n}}" (click)="generatePassword()">
appA11yTitle="{{'generatePassword' | i18n}}" (click)="generatePassword()"
*ngIf="cipher.viewPassword">
<i class="fa fa-lg fa-refresh" aria-hidden="true"></i>
</a>
</div>

View File

@ -46,19 +46,21 @@
<div class="action-buttons">
<button type="button" #checkPasswordBtn class="row-btn btn" appBlurClick
appA11yTitle="{{'checkPassword' | i18n}}" (click)="checkPassword()"
[appApiAction]="checkPasswordPromise" [disabled]="checkPasswordBtn.loading">
[appApiAction]="checkPasswordPromise" [disabled]="checkPasswordBtn.loading"
*ngIf="cipher.viewPassword">
<i class="fa fa-lg fa-check-circle" [hidden]="checkPasswordBtn.loading"
aria-hidden="true"></i>
<i class="fa fa-lg fa-spinner fa-spin" [hidden]="!checkPasswordBtn.loading"
aria-hidden="true"></i>
</button>
<a class="row-btn" href="#" appStopClick appA11yTitle="{{'toggleVisibility' | i18n}}"
(click)="togglePassword()">
(click)="togglePassword()" *ngIf="cipher.viewPassword">
<i class="fa fa-lg" aria-hidden="true"
[ngClass]="{'fa-eye': !showPassword, 'fa-eye-slash': showPassword}"></i>
</a>
<a class="row-btn" href="#" appStopClick appA11yTitle="{{'copyPassword' | i18n}}"
(click)="copy(cipher.login.password, 'password', 'Password')">
(click)="copy(cipher.login.password, 'password', 'Password')"
*ngIf="cipher.viewPassword">
<i class="fa fa-lg fa-clipboard" aria-hidden="true"></i>
</a>
</div>