changeset 67:b096facaa5b3

registration fix
author Goffi <goffi@goffi.org>
date Wed, 15 Jun 2011 20:22:27 +0200
parents 9d8e79ac4c9c
children c378653792b8
files browser_side/register.py libervia.tac
diffstat 2 files changed, 16 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/browser_side/register.py	Wed Jun 15 00:52:02 2011 +0200
+++ b/browser_side/register.py	Wed Jun 15 20:22:27 2011 +0200
@@ -61,10 +61,10 @@
         ##TabPanel##
         tab_bar = TabBar()
         tab_bar.setStyleName('registerPanel_tabs')
-        right_side = TabPanel(tab_bar) 
-        right_side.setStyleName('registerPanel_right_side')
-        main_panel.add(right_side)
-        main_panel.setCellWidth(right_side, '100%')
+        self.right_side = TabPanel(tab_bar) 
+        self.right_side.setStyleName('registerPanel_right_side')
+        main_panel.add(self.right_side)
+        main_panel.setCellWidth(self.right_side, '100%')
         
 
         ##Login tab##
@@ -106,8 +106,8 @@
         register_tab.setWidget(register_vpanel)
         
         register_login_label = Label('Login:')
-        register_login_box = TextBox()
-        register_login_box.setName("register_login")
+        self.register_login_box = TextBox()
+        self.register_login_box.setName("register_login")
         email_label = Label('E-mail:')
         self.email_box = TextBox()
         self.email_box.setName("email")
@@ -115,7 +115,7 @@
         self.register_pass_box = PasswordTextBox()
         self.register_pass_box.setName("register_password")
         register_vpanel.add(register_login_label)
-        register_vpanel.add(register_login_box)
+        register_vpanel.add(self.register_login_box)
         register_vpanel.add(email_label)
         register_vpanel.add(self.email_box)
         register_vpanel.add(register_pass_label)
@@ -126,9 +126,9 @@
         register_but.addStyleName('red')
         register_vpanel.add(register_but)
         
-        right_side.add(login_tab, 'Login')
-        right_side.add(register_tab, 'Register')
-        right_side.selectTab(0)
+        self.right_side.add(login_tab, 'Login')
+        self.right_side.add(register_tab, 'Register')
+        self.right_side.selectTab(0)
         
         self.add(main_panel)
         self.addFormHandler(self)
@@ -139,8 +139,7 @@
         self.submit()
 
     def onRegister(self, button):
-        print self.login_box.getText()
-        if not re.match(r'^[a-z0-9_-]+$',self.login_box.getText(), re.IGNORECASE):
+        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)
         elif not re.match(r'^.+@.+\..+', self.email_box.getText(), re.IGNORECASE):
@@ -168,7 +167,11 @@
             self.warning_msg.setVisible(True)
         elif result == "REGISTRATION":
             self.warning_msg.setVisible(False)
+            self.login_box.setText(self.register_login_box.getText())
+            self.register_login_box.setText('')
             self.register_pass_box.setText('')
+            self.email_box.setText('')
+            self.right_side.selectTab(0)
             Window.alert('An email has been sent to you with your login informations\nPlease remember that this is ONLY A TECHNICAL DEMO')
         else:
             Window.alert('Submit error: %s' % result)
--- a/libervia.tac	Wed Jun 15 00:52:02 2011 +0200
+++ b/libervia.tac	Wed Jun 15 20:22:27 2011 +0200
@@ -361,10 +361,9 @@
         @param args: dict of args as given by the form
         @return: "REGISTRATION" in case of success"""
         #TODO: must be moved in SàT core
-
         try:
             profile = login = args['register_login'][0]
-            password = request.args['register_password'][0] #FIXME: password is ignored so far
+            password = args['register_password'][0] #FIXME: password is ignored so far
             email = args['email'][0]
         except KeyError:
             return "BAD REQUEST"