changeset 161:03ac7f51a35b

browser side: fixed registration: - fixed warning messages (there are now 2 warning messages, one for login, one for registration) - fixed login & register tab sizes - added "INTERNAL" error, in case of something going really wrong at server side during account creation - minor typo corrections
author Goffi <goffi@goffi.org>
date Mon, 07 Jan 2013 01:15:19 +0100
parents 6f913f5adca8
children 6ebf7f872a38
files browser_side/register.py
diffstat 1 files changed, 24 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/browser_side/register.py	Mon Jan 07 01:09:57 2013 +0100
+++ b/browser_side/register.py	Mon Jan 07 01:15:19 2013 +0100
@@ -74,10 +74,10 @@
         login_tab.setWidget(login_vpanel)
         
         
-        self.warning_msg = Label()
-        self.warning_msg.setVisible(False)
-        self.warning_msg.setStyleName('formWarning')
-        #login_vpanel.add(self.warning_msg)
+        self.login_warning_msg = Label('')
+        self.login_warning_msg.setVisible(False)
+        self.login_warning_msg.setStyleName('formWarning')
+        login_vpanel.add(self.login_warning_msg)
 
         login_label = Label('Login:')
         self.login_box = TextBox()
@@ -105,6 +105,11 @@
         register_vpanel = VerticalPanel()
         register_tab.setWidget(register_vpanel)
         
+        self.register_warning_msg = Label('')
+        self.register_warning_msg.setVisible(False)
+        self.register_warning_msg.setStyleName('formWarning')
+        register_vpanel.add(self.register_warning_msg)
+        
         register_login_label = Label('Login:')
         self.register_login_box = TextBox()
         self.register_login_box.setName("register_login")
@@ -129,6 +134,8 @@
         self.right_side.add(login_tab, 'Login')
         self.right_side.add(register_tab, 'Register')
         self.right_side.selectTab(0)
+        login_tab.setWidth(None)
+        register_tab.setWidth(None)
         
         self.add(main_panel)
         self.addFormHandler(self)
@@ -140,13 +147,13 @@
 
     def onRegister(self, button):
         if not re.match(r'^[a-z0-9_-]+$',self.register_login_box.getText(), re.IGNORECASE):
-            self.warning_msg.setText('Invaling login, valid characters are a-z A-Z 0-9 _ -')
-            self.warning_msg.setVisible(True)
+            self.register_warning_msg.setText('Invalid login, valid characters are a-z A-Z 0-9 _ -')
+            self.register_warning_msg.setVisible(True)
         elif not re.match(r'^.+@.+\..+', self.email_box.getText(), re.IGNORECASE):
-            self.warning_msg.setText('Invaling email address')
-            self.warning_msg.setVisible(True)
+            self.register_warning_msg.setText('Invalid email address')
+            self.register_warning_msg.setVisible(True)
         else:
-            self.warning_msg.setVisible(False)
+            self.register_warning_msg.setVisible(False)
             self.submit_type.setValue('register')
             self.submit()
 
@@ -161,12 +168,16 @@
         elif result == "LOGGED":
             self.callback()
         elif result == "SESSION_ACTIVE":
-            Window.alert('Session already active, this should not happen, please contact contact the author to fix it')
+            Window.alert('Session already active, this should not happen, please contact the author to fix it')
         elif result == "ALREADY EXISTS":
-            self.warning_msg.setText('This login already exists, please choose an other one')
-            self.warning_msg.setVisible(True)
+            self.register_warning_msg.setText('This login already exists, please choose an other one')
+            self.register_warning_msg.setVisible(True)
+        elif result == "INTERNAL":
+            self.register_warning_msg.setText('SERVER ERROR: something went wrong during registration process, please contact the server administrator')
+            self.register_warning_msg.setVisible(True)
         elif result == "REGISTRATION":
-            self.warning_msg.setVisible(False)
+            self.login_warning_msg.setVisible(False)
+            self.register_warning_msg.setVisible(False)
             self.login_box.setText(self.register_login_box.getText())
             self.register_login_box.setText('')
             self.register_pass_box.setText('')