comparison 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
comparison
equal deleted inserted replaced
749:7168a9873dde 750:8ac862f6e5b3
169 169
170 def onKeyDown(self, sender, keycode, modifiers): 170 def onKeyDown(self, sender, keycode, modifiers):
171 pass 171 pass
172 172
173 def onLogin(self, button): 173 def onLogin(self, button):
174 if not re.match(r'^[a-z0-9_-]+$', self.login_box.getText(), re.IGNORECASE): 174 if not re.match(r'^[a-z0-9_-]+(@[a-z0-9_-]+\.[a-z0-9_-]+)?$', self.login_box.getText(), re.IGNORECASE):
175 self.login_warning_msg.setText('Invalid login, valid characters are a-z A-Z 0-9 _ -') 175 self.login_warning_msg.setHTML('Invalid login, valid characters<br>are a-z A-Z 0-9 _ - or a bare JID')
176 else: 176 else:
177 self.submit_type.setValue('login') 177 self.submit_type.setValue('login')
178 self.submit(None) 178 self.submit(None)
179 179
180 def onRegister(self, button): 180 def onRegister(self, button):
181 # XXX: for now libervia forces the creation to lower case 181 # XXX: for now libervia forces the creation to lower case
182 self.register_login_box.setText(self.register_login_box.getText().lower()) 182 self.register_login_box.setText(self.register_login_box.getText().lower())
183 if not re.match(r'^[a-z0-9_-]+$', self.register_login_box.getText(), re.IGNORECASE): 183 if not re.match(r'^[a-z0-9_-]+$', self.register_login_box.getText(), re.IGNORECASE):
184 self.register_warning_msg.setHTML(_('Invalid login, valid characters<br>are a-z A-Z 0-9 _ -')) 184 self.register_warning_msg.setHTML(_('Invalid login, valid characters<br>are a-z A-Z 0-9 _ -'))
185 elif not re.match(r'^.+@.+\..+', self.email_box.getText(), re.IGNORECASE): 185 elif not re.match(r'^[a-z0-9_-]+@[a-z0-9_-]+\.[a-z0-9_-]+$', self.email_box.getText(), re.IGNORECASE):
186 self.register_warning_msg.setHTML(_('Invalid email address')) 186 self.register_warning_msg.setHTML(_('Invalid email address'))
187 elif len(self.register_pass_box.getText()) < C.PASSWORD_MIN_LENGTH: 187 elif len(self.register_pass_box.getText()) < C.PASSWORD_MIN_LENGTH:
188 self.register_warning_msg.setHTML(_('Your password must contain<br>at least %d characters.') % C.PASSWORD_MIN_LENGTH) 188 self.register_warning_msg.setHTML(_('Your password must contain<br>at least %d characters.') % C.PASSWORD_MIN_LENGTH)
189 else: 189 else:
190 self.register_warning_msg.setHTML("") 190 self.register_warning_msg.setHTML("")