1
0
mirror of https://github.com/moparisthebest/mail synced 2024-11-25 10:22:18 -05:00

bugfix email validation

This commit is contained in:
Tankred Hase 2013-05-04 15:28:10 +02:00
parent ebbb16866a
commit d2565df871

View File

@ -240,14 +240,18 @@ app.dao.EmailDAO = function(_, crypto, devicestorage, cloudstorage, naclCrypto,
var userId = this.account.get('emailAddress'); var userId = this.account.get('emailAddress');
// validate email addresses // validate email addresses
var invalidRecipient;
_.each(email.get('to'), function(address) { _.each(email.get('to'), function(address) {
if (!validateEmail(address)) { if (!validateEmail(address)) {
invalidRecipient = address;
}
});
if (invalidRecipient) {
callback({ callback({
errMsg: 'Invalid recipient: ' + address errMsg: 'Invalid recipient: ' + invalidRecipient
}); });
return; return;
} }
});
if (!validateEmail(email.get('from'))) { if (!validateEmail(email.get('from'))) {
callback({ callback({
errMsg: 'Invalid sender: ' + email.from errMsg: 'Invalid sender: ' + email.from