changeset 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 631556a64850
children d97b0cba8b04
files browser_side/register.py
diffstat 1 files changed, 6 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/browser_side/register.py	Sun Jan 13 20:03:55 2013 +0100
+++ b/browser_side/register.py	Sun Jan 13 20:30:42 2013 +0100
@@ -28,18 +28,15 @@
 from pyjamas.ui.HorizontalPanel import HorizontalPanel
 from pyjamas.ui.TabPanel import TabPanel
 from pyjamas.ui.TabBar import TabBar
-from pyjamas.ui.Grid import Grid
 from pyjamas.ui.PasswordTextBox import PasswordTextBox
 from pyjamas.ui.TextBox import TextBox
 from pyjamas.ui.FormPanel import FormPanel
 from pyjamas.ui.Button import Button
 from pyjamas.ui.Label import Label
-from pyjamas.ui.CheckBox import CheckBox
 from pyjamas.ui.PopupPanel import PopupPanel
 from pyjamas.ui.Image import Image
 from pyjamas.ui.Hidden import Hidden
 from pyjamas import Window
-from pyjamas.ui import HasAlignment
 import re
 
 
@@ -142,8 +139,12 @@
         self.setAction('register_api/login')
 
     def onLogin(self, button):
-        self.submit_type.setValue('login')
-        self.submit()
+        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 _ -')
+            self.login_warning_msg.setVisible(True)
+        else:
+            self.submit_type.setValue('login')
+            self.submit()
 
     def onRegister(self, button):
         if not re.match(r'^[a-z0-9_-]+$',self.register_login_box.getText(), re.IGNORECASE):