diff src/browser/sat_browser/register.py @ 750:8ac862f6e5b3

browser and server sides: allow to connect with a JID that is not registered on the local server
author souliane <souliane@mailoo.org>
date Mon, 20 Jul 2015 10:16:10 +0200
parents 273b39f04d8e
children 249e49f56f67
line wrap: on
line diff
--- a/src/browser/sat_browser/register.py	Mon Nov 23 22:02:18 2015 +0100
+++ b/src/browser/sat_browser/register.py	Mon Jul 20 10:16:10 2015 +0200
@@ -171,8 +171,8 @@
         pass
 
     def onLogin(self, button):
-        if not re.match(r'^[a-z0-9_-]+$', self.login_box.getText(), re.IGNORECASE):
-            self.login_warning_msg.setText('Invalid login, valid characters are a-z A-Z 0-9 _ -')
+        if not re.match(r'^[a-z0-9_-]+(@[a-z0-9_-]+\.[a-z0-9_-]+)?$', self.login_box.getText(), re.IGNORECASE):
+            self.login_warning_msg.setHTML('Invalid login, valid characters<br>are a-z A-Z 0-9 _ - or a bare JID')
         else:
             self.submit_type.setValue('login')
             self.submit(None)
@@ -182,7 +182,7 @@
         self.register_login_box.setText(self.register_login_box.getText().lower())
         if not re.match(r'^[a-z0-9_-]+$', self.register_login_box.getText(), re.IGNORECASE):
             self.register_warning_msg.setHTML(_('Invalid login, valid characters<br>are a-z A-Z 0-9 _ -'))
-        elif not re.match(r'^.+@.+\..+', self.email_box.getText(), re.IGNORECASE):
+        elif not re.match(r'^[a-z0-9_-]+@[a-z0-9_-]+\.[a-z0-9_-]+$', self.email_box.getText(), re.IGNORECASE):
             self.register_warning_msg.setHTML(_('Invalid email address'))
         elif len(self.register_pass_box.getText()) < C.PASSWORD_MIN_LENGTH:
             self.register_warning_msg.setHTML(_('Your password must contain<br>at least %d characters.') % C.PASSWORD_MIN_LENGTH)