mirror of
https://github.com/moparisthebest/mail
synced 2025-02-07 02:20:14 -05:00
added exception handling for password/login
This commit is contained in:
parent
654a89055b
commit
8f0b698d27
@ -41,7 +41,15 @@ app.crypto.Crypto = function(window, util) {
|
||||
keyStore.persist(storageId, storedKey);
|
||||
} else {
|
||||
// decrypt key
|
||||
symmetricUserKey = aes.decrypt(storedKey.encryptedKey, pbkdf2, storedKey.keyIV);
|
||||
try {
|
||||
symmetricUserKey = aes.decrypt(storedKey.encryptedKey, pbkdf2, storedKey.keyIV);
|
||||
} catch (ex) {
|
||||
callback({
|
||||
errMsg: 'Wrong password!'
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
keyId = storedKey._id;
|
||||
|
||||
|
@ -29,7 +29,12 @@ app.dao.EmailDAO = function(_, crypto, devicestorage, cloudstorage, naclCrypto,
|
||||
});
|
||||
|
||||
function initCrypto() {
|
||||
crypto.init(account.get('emailAddress'), password, account.get('symKeySize'), account.get('symIvSize'), function() {
|
||||
crypto.init(account.get('emailAddress'), password, account.get('symKeySize'), account.get('symIvSize'), function(err) {
|
||||
if (err) {
|
||||
callback(err);
|
||||
return;
|
||||
}
|
||||
|
||||
initNaclCrypto();
|
||||
});
|
||||
}
|
||||
|
@ -39,8 +39,13 @@
|
||||
textVisible: true,
|
||||
theme: 'c'
|
||||
});
|
||||
this.dao.init(account, password, function() {
|
||||
this.dao.init(account, password, function(err) {
|
||||
$.mobile.loading('hide');
|
||||
if (err) {
|
||||
window.alert(err.errMsg);
|
||||
return;
|
||||
}
|
||||
|
||||
window.location = '#accounts/' + account.get('emailAddress') + '/folders';
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user