handling decryption errors caused by wrong password
This commit is contained in:
parent
6d3d54c44b
commit
5bfa169fff
1 changed files with 8 additions and 2 deletions
|
@ -41,8 +41,14 @@ Ember.computed.encrypted = function(encryptedField) {
|
|||
this.set(encryptedField, encryptedValue);
|
||||
}
|
||||
|
||||
encryptedValue = this.get(encryptedField);
|
||||
return Ember.isNone(encryptedValue) ? null : String( sjcl.decrypt( encryptKey , encryptedValue) );
|
||||
try {
|
||||
encryptedValue = this.get(encryptedField);
|
||||
decryptedValue = sjcl.decrypt( encryptKey , encryptedValue);
|
||||
} catch (e) {
|
||||
console.log('Error on decrypting. Perhaps a wrong encryption key?');
|
||||
decryptedValue = '';
|
||||
}
|
||||
return Ember.isNone(encryptedValue) ? null : String( decryptedValue );
|
||||
});
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue