mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-02 08:40:08 +01:00
Merge pull request #1249 from Hinton/feature/hidden-password
Add support for hidden password
This commit is contained in:
commit
25a86608b2
2
jslib
2
jslib
@ -1 +1 @@
|
||||
Subproject commit eef9588646091d268ef4c94f3d6db1412d9a99ab
|
||||
Subproject commit 2b6657a293e7be107271ad080c64ccd3f005afb7
|
@ -579,7 +579,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,
|
||||
|
@ -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>
|
||||
|
@ -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,
|
||||
|
@ -40,32 +40,36 @@
|
||||
<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>
|
||||
</div>
|
||||
<div class="box-content-row" appBoxRow>
|
||||
<label for="loginTotp">{{'authenticatorKeyTotp' | i18n}}</label>
|
||||
<input id="loginTotp" type="text" name="Login.Totp" class="monospaced"
|
||||
[(ngModel)]="cipher.login.totp" appInputVerbatim>
|
||||
<input id="loginTotp" type="{{cipher.viewPassword ? 'text' : 'password'}}" name="Login.Totp"
|
||||
class="monospaced" [(ngModel)]="cipher.login.totp" appInputVerbatim [disabled]="!cipher.viewPassword">
|
||||
</div>
|
||||
</div>
|
||||
<!-- Card -->
|
||||
@ -293,11 +297,13 @@
|
||||
*ngIf="f.type === fieldType.Text" placeholder="{{'value' | i18n}}" appInputVerbatim>
|
||||
<input id="fieldValue{{i}}" type="{{f.showValue ? 'text' : 'password'}}"
|
||||
name="Field.Value{{i}}" [(ngModel)]="f.value" class="monospaced" appInputVerbatim
|
||||
*ngIf="f.type === fieldType.Hidden" placeholder="{{'value' | i18n}}">
|
||||
*ngIf="f.type === fieldType.Hidden" placeholder="{{'value' | i18n}}"
|
||||
[disabled]="!cipher.viewPassword && !f.newField">
|
||||
</div>
|
||||
<input id="fieldValue{{i}}" name="Field.Value{{i}}" type="checkbox" [(ngModel)]="f.value"
|
||||
*ngIf="f.type === fieldType.Boolean" appTrueFalseValue trueValue="true" falseValue="false">
|
||||
<div class="action-buttons" *ngIf="f.type === fieldType.Hidden">
|
||||
<div class="action-buttons"
|
||||
*ngIf="f.type === fieldType.Hidden && (cipher.viewPassword || f.newField)">
|
||||
<a class="row-btn" href="#" appStopClick appBlurClick
|
||||
appA11yTitle="{{'toggleVisibility' | i18n}}" (click)="toggleFieldValue(f)">
|
||||
<i class="fa fa-lg" aria-hidden="true"
|
||||
|
@ -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>
|
||||
@ -231,12 +233,12 @@
|
||||
</div>
|
||||
<div class="action-buttons">
|
||||
<a class="row-btn" href="#" appStopClick appA11yTitle="{{'toggleVisibility' | i18n}}"
|
||||
*ngIf="field.type === fieldType.Hidden" (click)="toggleFieldValue(field)">
|
||||
*ngIf="field.type === fieldType.Hidden && cipher.viewPassword" (click)="toggleFieldValue(field)">
|
||||
<i class="fa fa-lg" aria-hidden="true"
|
||||
[ngClass]="{'fa-eye': !field.showValue, 'fa-eye-slash': field.showValue}"></i>
|
||||
</a>
|
||||
<a class="row-btn" href="#" appStopClick appA11yTitle="{{'copyValue' | i18n}}"
|
||||
*ngIf="field.value && field.type !== fieldType.Boolean"
|
||||
*ngIf="field.value && field.type !== fieldType.Boolean && !(field.type === fieldType.Hidden && !cipher.viewPassword)"
|
||||
(click)="copy(field.value, 'value', field.type === fieldType.Hidden ? 'H_Field' : 'Field')">
|
||||
<i class="fa fa-lg fa-clipboard" aria-hidden="true"></i>
|
||||
</a>
|
||||
|
Loading…
Reference in New Issue
Block a user