From a0cfe71084c0f97861ccaae36fded134abc8b69e Mon Sep 17 00:00:00 2001
From: Shane Tomlinson <stomlinson@mozilla.com>
Date: Thu, 11 Aug 2011 12:15:56 -0700
Subject: [PATCH] Checking the email address on submission

---
 browserid/static/dialog/controllers/addemail_controller.js | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/browserid/static/dialog/controllers/addemail_controller.js b/browserid/static/dialog/controllers/addemail_controller.js
index a4a810934..035b5faff 100644
--- a/browserid/static/dialog/controllers/addemail_controller.js
+++ b/browserid/static/dialog/controllers/addemail_controller.js
@@ -52,6 +52,11 @@
       this.find('input:first').attr('checked', true);
     },
 
+    validate: function() {
+      var email = $("#email_input").val();
+      return /^[\w.!#$%&'*+\-/=?\^`{|}~]+@[a-z0-9-]+(\.[a-z0-9-]+)*$/.test(email);
+    },
+
     submit: function() {
       // add the actual email
       // now we need to actually try to stage the creation of this account.
-- 
GitLab