Skip to content
This repository
Browse code

[FIX] Check Validation Email

  • Loading branch information...
commit 68ba89b6f1ae5c7aa7c8a0c601bb660e9c353fe0 1 parent c55253e
authored December 21, 2011

Showing 1 changed file with 4 additions and 6 deletions. Show diff stats Hide diff stats

  1. 10  poweremail_mailbox.py
10  poweremail_mailbox.py
@@ -31,6 +31,8 @@
31 31
 from tools.translate import _
32 32
 import tools
33 33
 
  34
+import re
  35
+
34 36
 LOGGER = netsvc.Logger()
35 37
 
36 38
 class PoweremailMailbox(osv.osv):
@@ -163,12 +165,8 @@ def check_email_valid(self, email):
163 165
         return True/False
164 166
         """
165 167
         def get_validate_email(email):
166  
-            sep=[x for x in email if not x.isalpha()]
167  
-            sepjoined=''.join(sep)
168  
-            if sepjoined.strip('.') != '@': return False
169  
-            for i in sep:
170  
-                part,i,email=email.partition(i)
171  
-                if len(part)<2: return False
  168
+            if not re.match(r"^[A-Za-z0-9\.\+_-]+@[A-Za-z0-9\._-]+\.[a-zA-Z]*$", email):
  169
+                return False
172 170
             return True
173 171
 
174 172
         if not email:

0 notes on commit 68ba89b

Please sign in to comment.
Something went wrong with that request. Please try again.