From 84ae3c3f849585382d006ac213066ef6a1a61c2f Mon Sep 17 00:00:00 2001 From: C Robert Date: Tue, 22 Sep 2009 20:36:28 +0000 Subject: [PATCH] Fixed email validation Monotone-Parent: 2e5131b1c08c6c88775f6c14a90fafed85109af8 Monotone-Revision: 0c9dd83dd8ccf4f99590b84d0154f2fdc166550f Monotone-Author: crobert@inverse.ca Monotone-Date: 2009-09-22T20:36:28 Monotone-Branch: ca.inverse.sogo --- UI/WebServerResources/UIxContactEditor.js | 26 +++++++++++++---------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/UI/WebServerResources/UIxContactEditor.js b/UI/WebServerResources/UIxContactEditor.js index 53dd5092d..3f281f3d6 100644 --- a/UI/WebServerResources/UIxContactEditor.js +++ b/UI/WebServerResources/UIxContactEditor.js @@ -80,21 +80,25 @@ function copyContact(type, email, uid, sn, }; function validateContactEditor() { - var e; + var rc = true; - e = $('workMail'); - if (e.value.length == 0) - return true; - if (uixEmailRegex.test(e.value) != true) - return confirm(labels.invalidemailwarn); + var e = $('workMail'); + if (e.value.length > 0 + && !uixEmailRegex.test(e.value)) + { + alert(getLabel ("invalidemailwarn")); + rc = false; + } e = $('homeMail'); - if (e.value.length == 0) - return true; - if (uixEmailRegex.test(e.value) != true) - return confirm(labels.invalidemailwarn); + if (e.value.length > 0 + && !uixEmailRegex.test(e.value)) + { + alert(getLabel ("invalidemailwarn")); + rc = false; + } - return true; + return rc; } function showCoords(node) {