1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-16 16:23:44 +00:00

Password reprompt (#357)

This commit is contained in:
Oscar Hinton
2021-04-29 13:31:21 +02:00
committed by GitHub
parent 1eb40a4891
commit a72c8a60c1
16 changed files with 161 additions and 12 deletions

View File

@@ -42,6 +42,7 @@ import { LoginUriView } from '../../models/view/loginUriView';
import { LoginView } from '../../models/view/loginView';
import { SecureNoteView } from '../../models/view/secureNoteView';
import { CipherRepromptType } from '../../enums/cipherRepromptType';
import { Utils } from '../../misc/utils';
@Directive()
@@ -71,6 +72,7 @@ export class AddEditComponent implements OnInit {
restorePromise: Promise<any>;
checkPasswordPromise: Promise<number>;
showPassword: boolean = false;
showCardNumber: boolean = false;
showCardCode: boolean = false;
cipherType = CipherType;
fieldType = FieldType;
@@ -84,6 +86,7 @@ export class AddEditComponent implements OnInit {
ownershipOptions: any[] = [];
currentDate = new Date();
allowPersonal = true;
reprompt: boolean = false;
protected writeableCollections: CollectionView[];
private previousCipherId: string;
@@ -245,6 +248,7 @@ export class AddEditComponent implements OnInit {
this.eventService.collect(EventType.Cipher_ClientViewed, this.cipherId);
}
this.previousCipherId = this.cipherId;
this.reprompt = this.cipher.reprompt !== CipherRepromptType.None;
}
async submit(): Promise<boolean> {
@@ -422,6 +426,13 @@ export class AddEditComponent implements OnInit {
}
}
async toggleCardNumber() {
this.showCardNumber = !this.showCardNumber;
if (this.showCardNumber) {
this.eventService.collect(EventType.Cipher_ClientToggledCardCodeVisible, this.cipherId);
}
}
toggleCardCode() {
this.showCardCode = !this.showCardCode;
document.getElementById('cardCode').focus();
@@ -488,6 +499,15 @@ export class AddEditComponent implements OnInit {
}
}
repromptChanged() {
this.reprompt = !this.reprompt;
if (this.reprompt) {
this.cipher.reprompt = CipherRepromptType.Password;
} else {
this.cipher.reprompt = CipherRepromptType.None;
}
}
protected async loadCollections() {
const allCollections = await this.collectionService.getAllDecrypted();
return allCollections.filter(c => !c.readOnly);