mirror of
https://github.com/bitwarden/browser
synced 2025-12-16 08:13:42 +00:00
Password reprompt fixes (#926)
* Hide card number when hidden * Avoid double password prompts * Bump jslib
This commit is contained in:
2
jslib
2
jslib
Submodule jslib updated: dddcc2bc93...25a91313ad
@@ -77,6 +77,7 @@ export class AddEditComponent extends BaseAddEditComponent implements OnChanges,
|
|||||||
|
|
||||||
onWindowHidden() {
|
onWindowHidden() {
|
||||||
this.showPassword = false;
|
this.showPassword = false;
|
||||||
|
this.showCardNumber = false;
|
||||||
this.showCardCode = false;
|
this.showCardCode = false;
|
||||||
if (this.cipher !== null && this.cipher.hasFields) {
|
if (this.cipher !== null && this.cipher.hasFields) {
|
||||||
this.cipher.fields.forEach(field => {
|
this.cipher.fields.forEach(field => {
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
(onAddCipherOptions)="addCipherOptions()">
|
(onAddCipherOptions)="addCipherOptions()">
|
||||||
</app-vault-ciphers>
|
</app-vault-ciphers>
|
||||||
<app-vault-view id="details" class="details" *ngIf="cipherId && action === 'view'" [cipherId]="cipherId"
|
<app-vault-view id="details" class="details" *ngIf="cipherId && action === 'view'" [cipherId]="cipherId"
|
||||||
(onCloneCipher)="cloneCipher($event)" (onEditCipher)="editCipher($event)"
|
(onCloneCipher)="cloneCipherWithoutPasswordPrompt($event)" (onEditCipher)="editCipherWithoutPasswordPrompt($event)"
|
||||||
(onViewCipherPasswordHistory)="viewCipherPasswordHistory($event)" (onRestoredCipher)="restoredCipher($event)"
|
(onViewCipherPasswordHistory)="viewCipherPasswordHistory($event)" (onRestoredCipher)="restoredCipher($event)"
|
||||||
(onDeletedCipher)="deletedCipher($event)">
|
(onDeletedCipher)="deletedCipher($event)">
|
||||||
</app-vault-view>
|
</app-vault-view>
|
||||||
|
|||||||
@@ -229,9 +229,7 @@ export class VaultComponent implements OnInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async viewCipher(cipher: CipherView) {
|
async viewCipher(cipher: CipherView) {
|
||||||
if (this.action === 'view' && this.cipherId === cipher.id) {
|
if (!await this.canNavigateAway('view', cipher)) {
|
||||||
return;
|
|
||||||
} else if (this.dirtyInput() && await this.wantsToSaveChanges()) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -328,11 +326,17 @@ export class VaultComponent implements OnInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async editCipher(cipher: CipherView) {
|
async editCipher(cipher: CipherView) {
|
||||||
if (this.action === 'edit' && this.cipherId === cipher.id) {
|
if (!await this.canNavigateAway('edit', cipher)) {
|
||||||
return;
|
return;
|
||||||
} else if (this.dirtyInput() && await this.wantsToSaveChanges()) {
|
} else if (!await this.passwordReprompt(cipher)) {
|
||||||
return;
|
return;
|
||||||
} else if (cipher.reprompt !== CipherRepromptType.None && !await this.passwordRepromptService.showPasswordPrompt()) {
|
}
|
||||||
|
|
||||||
|
await this.editCipherWithoutPasswordPrompt(cipher);
|
||||||
|
}
|
||||||
|
|
||||||
|
async editCipherWithoutPasswordPrompt(cipher: CipherView) {
|
||||||
|
if (!await this.canNavigateAway('edit', cipher)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -342,11 +346,17 @@ export class VaultComponent implements OnInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async cloneCipher(cipher: CipherView) {
|
async cloneCipher(cipher: CipherView) {
|
||||||
if (this.action === 'clone' && this.cipherId === cipher.id) {
|
if (!await this.canNavigateAway('clone', cipher)) {
|
||||||
return;
|
return;
|
||||||
} else if (this.dirtyInput() && await this.wantsToSaveChanges()) {
|
} else if (!await this.passwordReprompt(cipher)) {
|
||||||
return;
|
return;
|
||||||
} else if (cipher.reprompt !== CipherRepromptType.None && !await this.passwordRepromptService.showPasswordPrompt()) {
|
}
|
||||||
|
|
||||||
|
await this.cloneCipherWithoutPasswordPrompt(cipher);
|
||||||
|
}
|
||||||
|
|
||||||
|
async cloneCipherWithoutPasswordPrompt(cipher: CipherView) {
|
||||||
|
if (!await this.canNavigateAway('edit', cipher)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -356,9 +366,7 @@ export class VaultComponent implements OnInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async addCipher(type: CipherType = null) {
|
async addCipher(type: CipherType = null) {
|
||||||
if (this.action === 'add') {
|
if (!await this.canNavigateAway('add', null)) {
|
||||||
return;
|
|
||||||
} else if (this.dirtyInput() && await this.wantsToSaveChanges()) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -680,4 +688,19 @@ export class VaultComponent implements OnInit, OnDestroy {
|
|||||||
this.addOrganizationId = null;
|
this.addOrganizationId = null;
|
||||||
this.addCollectionIds = null;
|
this.addCollectionIds = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async canNavigateAway(action: string, cipher?: CipherView) {
|
||||||
|
// Don't navigate to same route
|
||||||
|
if (this.action === action && (cipher == null || this.cipherId === cipher.id)) {
|
||||||
|
return false;
|
||||||
|
} else if (this.dirtyInput() && await this.wantsToSaveChanges()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private async passwordReprompt(cipher: CipherView) {
|
||||||
|
return cipher.reprompt === CipherRepromptType.None || await this.passwordRepromptService.showPasswordPrompt();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -81,6 +81,7 @@ export class ViewComponent extends BaseViewComponent implements OnChanges {
|
|||||||
|
|
||||||
onWindowHidden() {
|
onWindowHidden() {
|
||||||
this.showPassword = false;
|
this.showPassword = false;
|
||||||
|
this.showCardNumber = false;
|
||||||
this.showCardCode = false;
|
this.showCardCode = false;
|
||||||
if (this.cipher !== null && this.cipher.hasFields) {
|
if (this.cipher !== null && this.cipher.hasFields) {
|
||||||
this.cipher.fields.forEach(field => {
|
this.cipher.fields.forEach(field => {
|
||||||
|
|||||||
Reference in New Issue
Block a user