diff options
author | Giovane <giovaneliberato@gmail.com> | 2015-10-26 17:01:18 -0200 |
---|---|---|
committer | Giovane <giovaneliberato@gmail.com> | 2015-10-26 17:01:39 -0200 |
commit | 2981e337140f67c1d555741fa5f9f663c651f26f (patch) | |
tree | 2f5e9f240177721eba4e39e4efb8d6df9d67ac0c /web-ui/app | |
parent | 800f211937e4e09a02779c20c6c79ce6edd833f1 (diff) |
Add incomplete email domain verification on compose box.
Diffstat (limited to 'web-ui/app')
-rw-r--r-- | web-ui/app/js/mail_view/ui/recipients/recipients_input.js | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/web-ui/app/js/mail_view/ui/recipients/recipients_input.js b/web-ui/app/js/mail_view/ui/recipients/recipients_input.js index 3e80b49e..2c3a4604 100644 --- a/web-ui/app/js/mail_view/ui/recipients/recipients_input.js +++ b/web-ui/app/js/mail_view/ui/recipients/recipients_input.js @@ -42,8 +42,8 @@ define([ }, self; - var simpleAddressMatch = /[^<\w,;]?([^\s<;,]+@[^\s>;,]+)/; - var canonicalAddressMatch = /([^,;\s][^,;@]+<[^\s;,]+@[^\s;,]+>)/; + var simpleAddressMatch = /[^<\w,;]?([^\s<;,]+@\w+\.[^\s>;,]+)/; + var canonicalAddressMatch = /([^,;\s][^,;@]+<[^\s;,]+@\w+\.[^\s;,]+>)/; var emailAddressMatch = new RegExp([simpleAddressMatch.source, '|', canonicalAddressMatch.source].join(''), 'g'); var extractContactNames = function (response) { @@ -112,31 +112,31 @@ define([ this.recipientSelected = function (event, data) { var value = (data && data.value) || this.$node.val(); - var that = this; - - function triggerEventForEach(addresses, event) { - _.each(addresses, function(address) { - if (!_.isEmpty(address.trim())) { - that.trigger(that.$node, event, { name: that.attr.name, address: address.trim() }); - } - }); - } var validAddresses = this.extractValidAddresses(value); var invalidAddresses = this.extractInvalidAddresses(value); - triggerEventForEach(validAddresses, events.ui.recipients.entered); - triggerEventForEach(invalidAddresses, events.ui.recipients.enteredInvalid); + this.triggerEventForEach(validAddresses, events.ui.recipients.entered); + this.triggerEventForEach(invalidAddresses, events.ui.recipients.enteredInvalid); reset(this.$node); }; - this.extractValidAddresses = function(rawAddresses) { + this.triggerEventForEach = function (addresses, event) { + var that = this; + _.each(addresses, function(address) { + if (!_.isEmpty(address.trim())) { + that.trigger(that.$node, event, { name: that.attr.name, address: address.trim() }); + } + }); + }; + + this.extractValidAddresses = function(rawAddresses) { return rawAddresses.match(emailAddressMatch); }; this.extractInvalidAddresses = function(rawAddresses) { - return rawAddresses.replace(emailAddressMatch, '').split(/[ ,;]/); + return rawAddresses.replace(emailAddressMatch, '').split(/[,;]/); }; this.init = function () { |