diff --git a/UI/Templates/ContactsUI/UIxContactEditorTemplate.wox b/UI/Templates/ContactsUI/UIxContactEditorTemplate.wox
index 9f59610c4..277f2f3b9 100644
--- a/UI/Templates/ContactsUI/UIxContactEditorTemplate.wox
+++ b/UI/Templates/ContactsUI/UIxContactEditorTemplate.wox
@@ -199,7 +199,8 @@
-
diff --git a/UI/Templates/PreferencesUI/UIxAccountEditor.wox b/UI/Templates/PreferencesUI/UIxAccountEditor.wox
index 534cfd3ee..8f5623fdb 100644
--- a/UI/Templates/PreferencesUI/UIxAccountEditor.wox
+++ b/UI/Templates/PreferencesUI/UIxAccountEditor.wox
@@ -164,9 +164,10 @@
-
+ ng-model="identity.replyTo"
+ ng-pattern="$AccountDialogController.emailRE"/>
-
diff --git a/UI/WebServerResources/js/Common/utils.js b/UI/WebServerResources/js/Common/utils.js
index 7c6ccfbc8..447c7213e 100644
--- a/UI/WebServerResources/js/Common/utils.js
+++ b/UI/WebServerResources/js/Common/utils.js
@@ -1,5 +1,7 @@
/* -*- Mode: javascript; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+String.emailRE = /([\w\!\#$\%\&\'\*\+\-\/\=\?\^\`{\|\}\~]+\.)*[\w\!\#$\%\&\'\*\+\-\/\=\?\^\`{\|\}\~]+@((((([\u00C0-\u017Fa-z0-9]{1}[\u00C0-\u017Fa-z0-9\-]{0,62}[\u00C0-\u017Fa-z0-9]{1})|[\u00C0-\u017Fa-z])\.)+[a-z]{2,})|(\d{1,3}\.){3}\d{1,3}(\:\d{1,5})?)/;
+
String.prototype.endsWith = function(suffix) {
return this.indexOf(suffix, this.length - suffix.length) !== -1;
};
@@ -135,10 +137,13 @@ String.prototype.formatted = function() {
};
String.prototype.isValidEmail = function(strict) {
- var emailRE = strict ?
- /^([\w\!\#$\%\&\'\*\+\-\/\=\?\^\`{\|\}\~]+\.)*[\w\!\#$\%\&\'\*\+\-\/\=\?\^\`{\|\}\~]+@((((([a-z0-9]{1}[a-z0-9\-]{0,62}[a-z0-9]{1})|[a-z])\.)+[a-z]{2,})|(\d{1,3}\.){3}\d{1,3}(\:\d{1,5})?)$/i : /([\w\!\#$\%\&\'\*\+\-\/\=\?\^\`{\|\}\~]+\.)*[\w\!\#$\%\&\'\*\+\-\/\=\?\^\`{\|\}\~]+@((((([a-z0-9]{1}[a-z0-9\-]{0,62}[a-z0-9]{1})|[a-z])\.)+[a-z]{2,})|(\d{1,3}\.){3}\d{1,3}(\:\d{1,5})?)/i;
+ var result = emailRE.test(this);
- return emailRE.test(this);
+ if (strict && result) {
+ result = emailRE.exec(this)[0] == this;
+ }
+
+ return result;
};
String.prototype.asCSSIdentifier = function() {
diff --git a/UI/WebServerResources/js/Contacts/CardController.js b/UI/WebServerResources/js/Contacts/CardController.js
index 9d2c1a307..4dda722a9 100644
--- a/UI/WebServerResources/js/Contacts/CardController.js
+++ b/UI/WebServerResources/js/Contacts/CardController.js
@@ -11,16 +11,17 @@
function CardController($scope, $timeout, $window, $mdDialog, sgSettings, AddressBook, Card, Dialog, sgHotkeys, focus, $state, $stateParams, stateCard) {
var vm = this, hotkeys = [];
- vm.card = stateCard;
+ this.card = stateCard;
- vm.currentFolder = AddressBook.selectedFolder;
- vm.allEmailTypes = Card.$EMAIL_TYPES;
- vm.allTelTypes = Card.$TEL_TYPES;
- vm.allUrlTypes = Card.$URL_TYPES;
- vm.allAddressTypes = Card.$ADDRESS_TYPES;
- vm.categories = {};
- vm.userFilterResults = [];
- vm.showRawSource = false;
+ this.currentFolder = AddressBook.selectedFolder;
+ this.allEmailTypes = Card.$EMAIL_TYPES;
+ this.allTelTypes = Card.$TEL_TYPES;
+ this.allUrlTypes = Card.$URL_TYPES;
+ this.allAddressTypes = Card.$ADDRESS_TYPES;
+ this.categories = {};
+ this.userFilterResults = [];
+ this.showRawSource = false;
+ this.emailRE = String.emailRE;
_registerHotkeys(hotkeys);
diff --git a/UI/WebServerResources/js/Mailer/Message.service.js b/UI/WebServerResources/js/Mailer/Message.service.js
index cf02869b1..8c13582bb 100644
--- a/UI/WebServerResources/js/Mailer/Message.service.js
+++ b/UI/WebServerResources/js/Mailer/Message.service.js
@@ -279,7 +279,7 @@
if (angular.isString(this[type])) {
// The recipient is a string; try to extract the name
var emailRE = /(([\w\!\#$\%\&\'\*\+\-\/\=\?\^\`{\|\}\~]+\.)*[\w\!\#$\%\&\'\*\+\-\/\=\?\^\`{\|\}\~]+@((((([a-z0-9]{1}[a-z0-9\-]{0,62}[a-z0-9]{1})|[a-z])\.)+[a-z]{2,})|(\d{1,3}\.){3}\d{1,3}(\:\d{1,5})?))/i;
- var match = this[type].match(emailRE);
+ var match = this[type].match(String.emailRE);
if (match) {
address = this[type].substring(0, match.index);
address = address.replace(/^\"? *(.+?)\"? *$/, "$1");
diff --git a/UI/WebServerResources/js/Preferences/AccountDialogController.js b/UI/WebServerResources/js/Preferences/AccountDialogController.js
index b1544de9c..8ca03a3b4 100644
--- a/UI/WebServerResources/js/Preferences/AccountDialogController.js
+++ b/UI/WebServerResources/js/Preferences/AccountDialogController.js
@@ -16,6 +16,7 @@
this.account = account;
this.accountId = accountId;
this.hostnameRE = usesSSO && accountId > 0 ? /^(?!(127\.0\.0\.1|localhost(?:\.localdomain)?)$)/ : /./;
+ this.emailRE = String.emailRE;
this.addressesSearchText = '';
this.ckConfig = {
'autoGrow_minHeight': 70,
diff --git a/UI/WebServerResources/js/Scheduler/ComponentController.js b/UI/WebServerResources/js/Scheduler/ComponentController.js
index 5a2238389..fe2cbdfd9 100644
--- a/UI/WebServerResources/js/Scheduler/ComponentController.js
+++ b/UI/WebServerResources/js/Scheduler/ComponentController.js
@@ -294,12 +294,11 @@
destinationCalendar = Calendar.$get(this.component.destinationCalendar),
options = initOrganizer? { organizerCalendar: destinationCalendar } : {},
promises = [];
- var emailRE = /([\w\!\#$\%\&\'\*\+\-\/\=\?\^\`{\|\}\~]+\.)*[\w\!\#$\%\&\'\*\+\-\/\=\?\^\`{\|\}\~]+@((((([a-z0-9]{1}[a-z0-9\-]{0,62}[a-z0-9]{1})|[a-z])\.)+[a-z]{2,})|(\d{1,3}\.){3}\d{1,3}(\:\d{1,5})?)/i,
- i, address;
+ var i, address;
if (partial) options.partial = partial;
function createCard(str) {
- var match = str.match(emailRE),
+ var match = str.match(String.emailRE),
email = match[0],
name = str.replace(new RegExp(" *" + email + ">? *"), '');
vm.showAttendeesEditor |= initOrganizer;
@@ -333,7 +332,7 @@
card.charCodeAt(i) == 32 || // space
card.charCodeAt(i) == 44 || // ,
card.charCodeAt(i) == 59) && // ;
- emailRE.test(address)) {
+ String.emailRE.test(address)) {
promises.push(createCard(address).then(addCard));
address = '';
}
@@ -341,7 +340,7 @@
address += card.charAt(i);
}
}
- if (address && emailRE.test(address)) {
+ if (address && String.emailRE.test(address)) {
promises.push(createCard(address).then(addCard));
}
}
diff --git a/UI/WebServerResources/js/Scheduler/sgCalendarListItem.directive.js b/UI/WebServerResources/js/Scheduler/sgCalendarListItem.directive.js
index 5cfbcf8d1..855ad659f 100644
--- a/UI/WebServerResources/js/Scheduler/sgCalendarListItem.directive.js
+++ b/UI/WebServerResources/js/Scheduler/sgCalendarListItem.directive.js
@@ -245,6 +245,7 @@
function PropertiesDialogController($scope, $mdDialog, srcCalendar) {
var vm = this;
+ vm.emailRE = String.emailRE;
vm.calendar = new Calendar(srcCalendar.$omit());
vm.saveProperties = saveProperties;
vm.close = close;