Mercurial > libervia-web
diff src/browser/sat_browser/register.py @ 851:77a494f13118
browser (register): improve some regex after Link Mauve's comments:
- accept . and + in the email address and external JID's user
- it is still very restrictive, but better than before
- TODO: check email reception or JID existence instead
author | souliane <souliane@mailoo.org> |
---|---|
date | Sat, 16 Jan 2016 10:48:31 +0100 |
parents | 7dafa5ee809a |
children | 54f6c5b86a87 |
line wrap: on
line diff
--- a/src/browser/sat_browser/register.py Fri Jan 15 18:00:07 2016 +0100 +++ b/src/browser/sat_browser/register.py Sat Jan 16 10:48:31 2016 +0100 @@ -190,7 +190,7 @@ if not self.checkLogin(self.register_login_box.getText()): self.register_warning_msg.setHTML(_('Invalid login, valid characters<br>are a-z A-Z 0-9 _ -')) elif not self.checkEmail(self.email_box.getText()): - self.register_warning_msg.setHTML(_('Invalid email address')) + self.register_warning_msg.setHTML(_('Invalid email address<br>(or not accepted yet)')) 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) else: @@ -242,6 +242,7 @@ @return bool """ # FIXME: Pyjamas re module is not stable so we use pure JS instead + # FIXME: login is restricted to this regex until we fix the account creation JS("""return /^(\w|-)+$/.test(text);""") def checkEmail(self, text): @@ -251,7 +252,8 @@ @return bool """ # FIXME: Pyjamas re module is not stable so we use pure JS instead - JS("""return /^(\w|-)+@(\w|-)+\.(\w|-)+$/.test(text);""") + # FIXME: send a message to validate the email instead of using a bad regex + JS("""return /^(\w|-|\.|\+)+@(\w|-)+\.(\w|-)+$/.test(text);""") def checkJID(self, text): """Check if the given text is a valid JID. @@ -260,7 +262,8 @@ @return bool """ # FIXME: Pyjamas re module is not stable so we use pure JS instead - JS("""return /^(\w|-)+(@(\w|-)+\.(\w|-)+)?$/.test(text);""") + # FIXME: this regex is too restrictive for people using external XMPP account + JS("""return /^(\w|-|\.|\+)+(@(\w|-)+\.(\w|-)+)?$/.test(text);""") class RegisterBox(PopupPanel):