comparison browser_side/register.py @ 173:3d998119237e

browser side: added login characters check in login panel (similar to the one in register panel)
author Goffi <goffi@goffi.org>
date Sun, 13 Jan 2013 20:30:42 +0100
parents 9763dec220ed
children 9827cda1a6b0
comparison
equal deleted inserted replaced
172:631556a64850 173:3d998119237e
26 from pyjamas.ui.SimplePanel import SimplePanel 26 from pyjamas.ui.SimplePanel import SimplePanel
27 from pyjamas.ui.VerticalPanel import VerticalPanel 27 from pyjamas.ui.VerticalPanel import VerticalPanel
28 from pyjamas.ui.HorizontalPanel import HorizontalPanel 28 from pyjamas.ui.HorizontalPanel import HorizontalPanel
29 from pyjamas.ui.TabPanel import TabPanel 29 from pyjamas.ui.TabPanel import TabPanel
30 from pyjamas.ui.TabBar import TabBar 30 from pyjamas.ui.TabBar import TabBar
31 from pyjamas.ui.Grid import Grid
32 from pyjamas.ui.PasswordTextBox import PasswordTextBox 31 from pyjamas.ui.PasswordTextBox import PasswordTextBox
33 from pyjamas.ui.TextBox import TextBox 32 from pyjamas.ui.TextBox import TextBox
34 from pyjamas.ui.FormPanel import FormPanel 33 from pyjamas.ui.FormPanel import FormPanel
35 from pyjamas.ui.Button import Button 34 from pyjamas.ui.Button import Button
36 from pyjamas.ui.Label import Label 35 from pyjamas.ui.Label import Label
37 from pyjamas.ui.CheckBox import CheckBox
38 from pyjamas.ui.PopupPanel import PopupPanel 36 from pyjamas.ui.PopupPanel import PopupPanel
39 from pyjamas.ui.Image import Image 37 from pyjamas.ui.Image import Image
40 from pyjamas.ui.Hidden import Hidden 38 from pyjamas.ui.Hidden import Hidden
41 from pyjamas import Window 39 from pyjamas import Window
42 from pyjamas.ui import HasAlignment
43 import re 40 import re
44 41
45 42
46 class RegisterPanel(FormPanel): 43 class RegisterPanel(FormPanel):
47 44
140 self.add(main_panel) 137 self.add(main_panel)
141 self.addFormHandler(self) 138 self.addFormHandler(self)
142 self.setAction('register_api/login') 139 self.setAction('register_api/login')
143 140
144 def onLogin(self, button): 141 def onLogin(self, button):
145 self.submit_type.setValue('login') 142 if not re.match(r'^[a-z0-9_-]+$',self.login_box.getText(), re.IGNORECASE):
146 self.submit() 143 self.login_warning_msg.setText('Invalid login, valid characters are a-z A-Z 0-9 _ -')
144 self.login_warning_msg.setVisible(True)
145 else:
146 self.submit_type.setValue('login')
147 self.submit()
147 148
148 def onRegister(self, button): 149 def onRegister(self, button):
149 if not re.match(r'^[a-z0-9_-]+$',self.register_login_box.getText(), re.IGNORECASE): 150 if not re.match(r'^[a-z0-9_-]+$',self.register_login_box.getText(), re.IGNORECASE):
150 self.register_warning_msg.setText('Invalid login, valid characters are a-z A-Z 0-9 _ -') 151 self.register_warning_msg.setText('Invalid login, valid characters are a-z A-Z 0-9 _ -')
151 self.register_warning_msg.setVisible(True) 152 self.register_warning_msg.setVisible(True)