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

allow overridable encrypt function

This commit is contained in:
Kyle Spearrin
2018-07-05 10:10:15 -04:00
parent 9b008ff382
commit ef5eebba66

View File

@@ -157,13 +157,13 @@ export class AddEditComponent {
return false; return false;
} }
if (!this.editMode && this.cipher.type === CipherType.Login && this.cipher.login.uris.length === 1 && if (!this.editMode && this.cipher.type === CipherType.Login &&
this.cipher.login.uris != null && this.cipher.login.uris.length === 1 &&
(this.cipher.login.uris[0].uri == null || this.cipher.login.uris[0].uri === '')) { (this.cipher.login.uris[0].uri == null || this.cipher.login.uris[0].uri === '')) {
this.cipher.login.uris = null; this.cipher.login.uris = null;
} }
const cipher = await this.cipherService.encrypt(this.cipher); const cipher = await this.encryptCipher();
try { try {
this.formPromise = this.saveCipher(cipher); this.formPromise = this.saveCipher(cipher);
await this.formPromise; await this.formPromise;
@@ -311,6 +311,10 @@ export class AddEditComponent {
return this.cipherService.get(this.cipherId); return this.cipherService.get(this.cipherId);
} }
protected encryptCipher() {
return this.cipherService.encrypt(this.cipher);
}
protected saveCipher(cipher: Cipher) { protected saveCipher(cipher: Cipher) {
return this.cipherService.saveWithServer(cipher); return this.cipherService.saveWithServer(cipher);
} }