1
0
mirror of https://github.com/moparisthebest/mail synced 2024-11-25 02:12:17 -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');
// validate email addresses
var invalidRecipient;
_.each(email.get('to'), function(address) {
if (!validateEmail(address)) {
callback({
errMsg: 'Invalid recipient: ' + address
});
return;
invalidRecipient = address;
}
});
if (invalidRecipient) {
callback({
errMsg: 'Invalid recipient: ' + invalidRecipient
});
return;
}
if (!validateEmail(email.get('from'))) {
callback({
errMsg: 'Invalid sender: ' + email.from