annotate browser_side/register.py @ 67:b096facaa5b3

registration fix
author Goffi <goffi@goffi.org>
date Wed, 15 Jun 2011 20:22:27 +0200
parents 9d8e79ac4c9c
children 975e6be24e11
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
140cec48224a Initial commit
Goffi <goffi@goffi.org>
parents:
diff changeset
1 #!/usr/bin/python
140cec48224a Initial commit
Goffi <goffi@goffi.org>
parents:
diff changeset
2 # -*- coding: utf-8 -*-
140cec48224a Initial commit
Goffi <goffi@goffi.org>
parents:
diff changeset
3
140cec48224a Initial commit
Goffi <goffi@goffi.org>
parents:
diff changeset
4 """
140cec48224a Initial commit
Goffi <goffi@goffi.org>
parents:
diff changeset
5 Libervia: a Salut à Toi frontend
66
9d8e79ac4c9c Login/Register box: integration of Adrien Vigneron's design
Goffi <goffi@goffi.org>
parents: 62
diff changeset
6 Copyright (C) 2011 Jérôme Poisson <goffi@goffi.org>
9d8e79ac4c9c Login/Register box: integration of Adrien Vigneron's design
Goffi <goffi@goffi.org>
parents: 62
diff changeset
7 Copyright (C) 2011 Adrien Vigneron <adrienvigneron@mailoo.org>
0
140cec48224a Initial commit
Goffi <goffi@goffi.org>
parents:
diff changeset
8
140cec48224a Initial commit
Goffi <goffi@goffi.org>
parents:
diff changeset
9 This program is free software: you can redistribute it and/or modify
140cec48224a Initial commit
Goffi <goffi@goffi.org>
parents:
diff changeset
10 it under the terms of the GNU Affero General Public License as published by
140cec48224a Initial commit
Goffi <goffi@goffi.org>
parents:
diff changeset
11 the Free Software Foundation, either version 3 of the License, or
140cec48224a Initial commit
Goffi <goffi@goffi.org>
parents:
diff changeset
12 (at your option) any later version.
140cec48224a Initial commit
Goffi <goffi@goffi.org>
parents:
diff changeset
13
140cec48224a Initial commit
Goffi <goffi@goffi.org>
parents:
diff changeset
14 This program is distributed in the hope that it will be useful,
140cec48224a Initial commit
Goffi <goffi@goffi.org>
parents:
diff changeset
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
140cec48224a Initial commit
Goffi <goffi@goffi.org>
parents:
diff changeset
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
140cec48224a Initial commit
Goffi <goffi@goffi.org>
parents:
diff changeset
17 GNU Affero General Public License for more details.
140cec48224a Initial commit
Goffi <goffi@goffi.org>
parents:
diff changeset
18
140cec48224a Initial commit
Goffi <goffi@goffi.org>
parents:
diff changeset
19 You should have received a copy of the GNU Affero General Public License
140cec48224a Initial commit
Goffi <goffi@goffi.org>
parents:
diff changeset
20 along with this program. If not, see <http://www.gnu.org/licenses/>.
140cec48224a Initial commit
Goffi <goffi@goffi.org>
parents:
diff changeset
21 """
140cec48224a Initial commit
Goffi <goffi@goffi.org>
parents:
diff changeset
22
140cec48224a Initial commit
Goffi <goffi@goffi.org>
parents:
diff changeset
23 #This page manage subscription and new account creation
140cec48224a Initial commit
Goffi <goffi@goffi.org>
parents:
diff changeset
24 import pyjd # this is dummy in pyjs
140cec48224a Initial commit
Goffi <goffi@goffi.org>
parents:
diff changeset
25
66
9d8e79ac4c9c Login/Register box: integration of Adrien Vigneron's design
Goffi <goffi@goffi.org>
parents: 62
diff changeset
26 from pyjamas.ui.SimplePanel import SimplePanel
0
140cec48224a Initial commit
Goffi <goffi@goffi.org>
parents:
diff changeset
27 from pyjamas.ui.VerticalPanel import VerticalPanel
66
9d8e79ac4c9c Login/Register box: integration of Adrien Vigneron's design
Goffi <goffi@goffi.org>
parents: 62
diff changeset
28 from pyjamas.ui.HorizontalPanel import HorizontalPanel
9d8e79ac4c9c Login/Register box: integration of Adrien Vigneron's design
Goffi <goffi@goffi.org>
parents: 62
diff changeset
29 from pyjamas.ui.TabPanel import TabPanel
9d8e79ac4c9c Login/Register box: integration of Adrien Vigneron's design
Goffi <goffi@goffi.org>
parents: 62
diff changeset
30 from pyjamas.ui.TabBar import TabBar
0
140cec48224a Initial commit
Goffi <goffi@goffi.org>
parents:
diff changeset
31 from pyjamas.ui.Grid import Grid
140cec48224a Initial commit
Goffi <goffi@goffi.org>
parents:
diff changeset
32 from pyjamas.ui.PasswordTextBox import PasswordTextBox
140cec48224a Initial commit
Goffi <goffi@goffi.org>
parents:
diff changeset
33 from pyjamas.ui.TextBox import TextBox
140cec48224a Initial commit
Goffi <goffi@goffi.org>
parents:
diff changeset
34 from pyjamas.ui.FormPanel import FormPanel
140cec48224a Initial commit
Goffi <goffi@goffi.org>
parents:
diff changeset
35 from pyjamas.ui.Button import Button
46
c3ee630914ba Account creation
Goffi <goffi@goffi.org>
parents: 43
diff changeset
36 from pyjamas.ui.Label import Label
c3ee630914ba Account creation
Goffi <goffi@goffi.org>
parents: 43
diff changeset
37 from pyjamas.ui.CheckBox import CheckBox
66
9d8e79ac4c9c Login/Register box: integration of Adrien Vigneron's design
Goffi <goffi@goffi.org>
parents: 62
diff changeset
38 from pyjamas.ui.PopupPanel import PopupPanel
9d8e79ac4c9c Login/Register box: integration of Adrien Vigneron's design
Goffi <goffi@goffi.org>
parents: 62
diff changeset
39 from pyjamas.ui.Image import Image
9d8e79ac4c9c Login/Register box: integration of Adrien Vigneron's design
Goffi <goffi@goffi.org>
parents: 62
diff changeset
40 from pyjamas.ui.Hidden import Hidden
0
140cec48224a Initial commit
Goffi <goffi@goffi.org>
parents:
diff changeset
41 from pyjamas import Window
140cec48224a Initial commit
Goffi <goffi@goffi.org>
parents:
diff changeset
42 from pyjamas.ui import HasAlignment
46
c3ee630914ba Account creation
Goffi <goffi@goffi.org>
parents: 43
diff changeset
43 import re
0
140cec48224a Initial commit
Goffi <goffi@goffi.org>
parents:
diff changeset
44
140cec48224a Initial commit
Goffi <goffi@goffi.org>
parents:
diff changeset
45
140cec48224a Initial commit
Goffi <goffi@goffi.org>
parents:
diff changeset
46 class RegisterPanel(FormPanel):
140cec48224a Initial commit
Goffi <goffi@goffi.org>
parents:
diff changeset
47
140cec48224a Initial commit
Goffi <goffi@goffi.org>
parents:
diff changeset
48 def __init__(self, callback):
140cec48224a Initial commit
Goffi <goffi@goffi.org>
parents:
diff changeset
49 """
140cec48224a Initial commit
Goffi <goffi@goffi.org>
parents:
diff changeset
50 @param callback: method to call if login successful
140cec48224a Initial commit
Goffi <goffi@goffi.org>
parents:
diff changeset
51 """
140cec48224a Initial commit
Goffi <goffi@goffi.org>
parents:
diff changeset
52 FormPanel.__init__(self)
66
9d8e79ac4c9c Login/Register box: integration of Adrien Vigneron's design
Goffi <goffi@goffi.org>
parents: 62
diff changeset
53 self.setSize('600px', '350px')
0
140cec48224a Initial commit
Goffi <goffi@goffi.org>
parents:
diff changeset
54 self.callback = callback
140cec48224a Initial commit
Goffi <goffi@goffi.org>
parents:
diff changeset
55 self.setMethod(FormPanel.METHOD_POST)
66
9d8e79ac4c9c Login/Register box: integration of Adrien Vigneron's design
Goffi <goffi@goffi.org>
parents: 62
diff changeset
56 main_panel = HorizontalPanel()
9d8e79ac4c9c Login/Register box: integration of Adrien Vigneron's design
Goffi <goffi@goffi.org>
parents: 62
diff changeset
57 main_panel.setStyleName('registerPanel_main')
9d8e79ac4c9c Login/Register box: integration of Adrien Vigneron's design
Goffi <goffi@goffi.org>
parents: 62
diff changeset
58 left_side = Image("register_left.png")
9d8e79ac4c9c Login/Register box: integration of Adrien Vigneron's design
Goffi <goffi@goffi.org>
parents: 62
diff changeset
59 main_panel.add(left_side)
9d8e79ac4c9c Login/Register box: integration of Adrien Vigneron's design
Goffi <goffi@goffi.org>
parents: 62
diff changeset
60
9d8e79ac4c9c Login/Register box: integration of Adrien Vigneron's design
Goffi <goffi@goffi.org>
parents: 62
diff changeset
61 ##TabPanel##
9d8e79ac4c9c Login/Register box: integration of Adrien Vigneron's design
Goffi <goffi@goffi.org>
parents: 62
diff changeset
62 tab_bar = TabBar()
9d8e79ac4c9c Login/Register box: integration of Adrien Vigneron's design
Goffi <goffi@goffi.org>
parents: 62
diff changeset
63 tab_bar.setStyleName('registerPanel_tabs')
67
b096facaa5b3 registration fix
Goffi <goffi@goffi.org>
parents: 66
diff changeset
64 self.right_side = TabPanel(tab_bar)
b096facaa5b3 registration fix
Goffi <goffi@goffi.org>
parents: 66
diff changeset
65 self.right_side.setStyleName('registerPanel_right_side')
b096facaa5b3 registration fix
Goffi <goffi@goffi.org>
parents: 66
diff changeset
66 main_panel.add(self.right_side)
b096facaa5b3 registration fix
Goffi <goffi@goffi.org>
parents: 66
diff changeset
67 main_panel.setCellWidth(self.right_side, '100%')
66
9d8e79ac4c9c Login/Register box: integration of Adrien Vigneron's design
Goffi <goffi@goffi.org>
parents: 62
diff changeset
68
9d8e79ac4c9c Login/Register box: integration of Adrien Vigneron's design
Goffi <goffi@goffi.org>
parents: 62
diff changeset
69
9d8e79ac4c9c Login/Register box: integration of Adrien Vigneron's design
Goffi <goffi@goffi.org>
parents: 62
diff changeset
70 ##Login tab##
9d8e79ac4c9c Login/Register box: integration of Adrien Vigneron's design
Goffi <goffi@goffi.org>
parents: 62
diff changeset
71 login_tab = SimplePanel()
9d8e79ac4c9c Login/Register box: integration of Adrien Vigneron's design
Goffi <goffi@goffi.org>
parents: 62
diff changeset
72 login_tab.setStyleName('registerPanel_content')
9d8e79ac4c9c Login/Register box: integration of Adrien Vigneron's design
Goffi <goffi@goffi.org>
parents: 62
diff changeset
73 login_vpanel = VerticalPanel()
9d8e79ac4c9c Login/Register box: integration of Adrien Vigneron's design
Goffi <goffi@goffi.org>
parents: 62
diff changeset
74 login_tab.setWidget(login_vpanel)
9d8e79ac4c9c Login/Register box: integration of Adrien Vigneron's design
Goffi <goffi@goffi.org>
parents: 62
diff changeset
75
9d8e79ac4c9c Login/Register box: integration of Adrien Vigneron's design
Goffi <goffi@goffi.org>
parents: 62
diff changeset
76
46
c3ee630914ba Account creation
Goffi <goffi@goffi.org>
parents: 43
diff changeset
77 self.warning_msg = Label()
c3ee630914ba Account creation
Goffi <goffi@goffi.org>
parents: 43
diff changeset
78 self.warning_msg.setVisible(False)
c3ee630914ba Account creation
Goffi <goffi@goffi.org>
parents: 43
diff changeset
79 self.warning_msg.setStyleName('formWarning')
66
9d8e79ac4c9c Login/Register box: integration of Adrien Vigneron's design
Goffi <goffi@goffi.org>
parents: 62
diff changeset
80 #login_vpanel.add(self.warning_msg)
46
c3ee630914ba Account creation
Goffi <goffi@goffi.org>
parents: 43
diff changeset
81
66
9d8e79ac4c9c Login/Register box: integration of Adrien Vigneron's design
Goffi <goffi@goffi.org>
parents: 62
diff changeset
82 login_label = Label('Login:')
46
c3ee630914ba Account creation
Goffi <goffi@goffi.org>
parents: 43
diff changeset
83 self.login_box = TextBox()
c3ee630914ba Account creation
Goffi <goffi@goffi.org>
parents: 43
diff changeset
84 self.login_box.setName("login")
66
9d8e79ac4c9c Login/Register box: integration of Adrien Vigneron's design
Goffi <goffi@goffi.org>
parents: 62
diff changeset
85 login_pass_label = Label('Password:')
9d8e79ac4c9c Login/Register box: integration of Adrien Vigneron's design
Goffi <goffi@goffi.org>
parents: 62
diff changeset
86 login_pass_box = PasswordTextBox()
9d8e79ac4c9c Login/Register box: integration of Adrien Vigneron's design
Goffi <goffi@goffi.org>
parents: 62
diff changeset
87 login_pass_box.setName("login_password")
9d8e79ac4c9c Login/Register box: integration of Adrien Vigneron's design
Goffi <goffi@goffi.org>
parents: 62
diff changeset
88 login_vpanel.add(login_label)
9d8e79ac4c9c Login/Register box: integration of Adrien Vigneron's design
Goffi <goffi@goffi.org>
parents: 62
diff changeset
89 login_vpanel.add(self.login_box)
9d8e79ac4c9c Login/Register box: integration of Adrien Vigneron's design
Goffi <goffi@goffi.org>
parents: 62
diff changeset
90 login_vpanel.add(login_pass_label)
9d8e79ac4c9c Login/Register box: integration of Adrien Vigneron's design
Goffi <goffi@goffi.org>
parents: 62
diff changeset
91 login_vpanel.add(login_pass_box)
9d8e79ac4c9c Login/Register box: integration of Adrien Vigneron's design
Goffi <goffi@goffi.org>
parents: 62
diff changeset
92 login_but = Button("Log in", getattr(self, "onLogin"))
9d8e79ac4c9c Login/Register box: integration of Adrien Vigneron's design
Goffi <goffi@goffi.org>
parents: 62
diff changeset
93 login_but.setStyleName('button')
9d8e79ac4c9c Login/Register box: integration of Adrien Vigneron's design
Goffi <goffi@goffi.org>
parents: 62
diff changeset
94 login_but.addStyleName('red')
9d8e79ac4c9c Login/Register box: integration of Adrien Vigneron's design
Goffi <goffi@goffi.org>
parents: 62
diff changeset
95 login_vpanel.add(login_but)
9d8e79ac4c9c Login/Register box: integration of Adrien Vigneron's design
Goffi <goffi@goffi.org>
parents: 62
diff changeset
96
9d8e79ac4c9c Login/Register box: integration of Adrien Vigneron's design
Goffi <goffi@goffi.org>
parents: 62
diff changeset
97 #The hidden submit_type field
9d8e79ac4c9c Login/Register box: integration of Adrien Vigneron's design
Goffi <goffi@goffi.org>
parents: 62
diff changeset
98 self.submit_type = Hidden('submit_type')
9d8e79ac4c9c Login/Register box: integration of Adrien Vigneron's design
Goffi <goffi@goffi.org>
parents: 62
diff changeset
99 login_vpanel.add(self.submit_type)
9d8e79ac4c9c Login/Register box: integration of Adrien Vigneron's design
Goffi <goffi@goffi.org>
parents: 62
diff changeset
100
46
c3ee630914ba Account creation
Goffi <goffi@goffi.org>
parents: 43
diff changeset
101
66
9d8e79ac4c9c Login/Register box: integration of Adrien Vigneron's design
Goffi <goffi@goffi.org>
parents: 62
diff changeset
102 ##Register tab##
9d8e79ac4c9c Login/Register box: integration of Adrien Vigneron's design
Goffi <goffi@goffi.org>
parents: 62
diff changeset
103 register_tab = SimplePanel()
9d8e79ac4c9c Login/Register box: integration of Adrien Vigneron's design
Goffi <goffi@goffi.org>
parents: 62
diff changeset
104 register_tab.setStyleName('registerPanel_content')
9d8e79ac4c9c Login/Register box: integration of Adrien Vigneron's design
Goffi <goffi@goffi.org>
parents: 62
diff changeset
105 register_vpanel = VerticalPanel()
9d8e79ac4c9c Login/Register box: integration of Adrien Vigneron's design
Goffi <goffi@goffi.org>
parents: 62
diff changeset
106 register_tab.setWidget(register_vpanel)
46
c3ee630914ba Account creation
Goffi <goffi@goffi.org>
parents: 43
diff changeset
107
66
9d8e79ac4c9c Login/Register box: integration of Adrien Vigneron's design
Goffi <goffi@goffi.org>
parents: 62
diff changeset
108 register_login_label = Label('Login:')
67
b096facaa5b3 registration fix
Goffi <goffi@goffi.org>
parents: 66
diff changeset
109 self.register_login_box = TextBox()
b096facaa5b3 registration fix
Goffi <goffi@goffi.org>
parents: 66
diff changeset
110 self.register_login_box.setName("register_login")
66
9d8e79ac4c9c Login/Register box: integration of Adrien Vigneron's design
Goffi <goffi@goffi.org>
parents: 62
diff changeset
111 email_label = Label('E-mail:')
46
c3ee630914ba Account creation
Goffi <goffi@goffi.org>
parents: 43
diff changeset
112 self.email_box = TextBox()
c3ee630914ba Account creation
Goffi <goffi@goffi.org>
parents: 43
diff changeset
113 self.email_box.setName("email")
66
9d8e79ac4c9c Login/Register box: integration of Adrien Vigneron's design
Goffi <goffi@goffi.org>
parents: 62
diff changeset
114 register_pass_label = Label('Password:')
9d8e79ac4c9c Login/Register box: integration of Adrien Vigneron's design
Goffi <goffi@goffi.org>
parents: 62
diff changeset
115 self.register_pass_box = PasswordTextBox()
9d8e79ac4c9c Login/Register box: integration of Adrien Vigneron's design
Goffi <goffi@goffi.org>
parents: 62
diff changeset
116 self.register_pass_box.setName("register_password")
9d8e79ac4c9c Login/Register box: integration of Adrien Vigneron's design
Goffi <goffi@goffi.org>
parents: 62
diff changeset
117 register_vpanel.add(register_login_label)
67
b096facaa5b3 registration fix
Goffi <goffi@goffi.org>
parents: 66
diff changeset
118 register_vpanel.add(self.register_login_box)
66
9d8e79ac4c9c Login/Register box: integration of Adrien Vigneron's design
Goffi <goffi@goffi.org>
parents: 62
diff changeset
119 register_vpanel.add(email_label)
9d8e79ac4c9c Login/Register box: integration of Adrien Vigneron's design
Goffi <goffi@goffi.org>
parents: 62
diff changeset
120 register_vpanel.add(self.email_box)
9d8e79ac4c9c Login/Register box: integration of Adrien Vigneron's design
Goffi <goffi@goffi.org>
parents: 62
diff changeset
121 register_vpanel.add(register_pass_label)
9d8e79ac4c9c Login/Register box: integration of Adrien Vigneron's design
Goffi <goffi@goffi.org>
parents: 62
diff changeset
122 register_vpanel.add(self.register_pass_box)
9d8e79ac4c9c Login/Register box: integration of Adrien Vigneron's design
Goffi <goffi@goffi.org>
parents: 62
diff changeset
123
9d8e79ac4c9c Login/Register box: integration of Adrien Vigneron's design
Goffi <goffi@goffi.org>
parents: 62
diff changeset
124 register_but = Button("Register", getattr(self, "onRegister"))
9d8e79ac4c9c Login/Register box: integration of Adrien Vigneron's design
Goffi <goffi@goffi.org>
parents: 62
diff changeset
125 register_but.setStyleName('button')
9d8e79ac4c9c Login/Register box: integration of Adrien Vigneron's design
Goffi <goffi@goffi.org>
parents: 62
diff changeset
126 register_but.addStyleName('red')
9d8e79ac4c9c Login/Register box: integration of Adrien Vigneron's design
Goffi <goffi@goffi.org>
parents: 62
diff changeset
127 register_vpanel.add(register_but)
46
c3ee630914ba Account creation
Goffi <goffi@goffi.org>
parents: 43
diff changeset
128
67
b096facaa5b3 registration fix
Goffi <goffi@goffi.org>
parents: 66
diff changeset
129 self.right_side.add(login_tab, 'Login')
b096facaa5b3 registration fix
Goffi <goffi@goffi.org>
parents: 66
diff changeset
130 self.right_side.add(register_tab, 'Register')
b096facaa5b3 registration fix
Goffi <goffi@goffi.org>
parents: 66
diff changeset
131 self.right_side.selectTab(0)
66
9d8e79ac4c9c Login/Register box: integration of Adrien Vigneron's design
Goffi <goffi@goffi.org>
parents: 62
diff changeset
132
9d8e79ac4c9c Login/Register box: integration of Adrien Vigneron's design
Goffi <goffi@goffi.org>
parents: 62
diff changeset
133 self.add(main_panel)
0
140cec48224a Initial commit
Goffi <goffi@goffi.org>
parents:
diff changeset
134 self.addFormHandler(self)
140cec48224a Initial commit
Goffi <goffi@goffi.org>
parents:
diff changeset
135 self.setAction('register_api/login')
140cec48224a Initial commit
Goffi <goffi@goffi.org>
parents:
diff changeset
136
62
12e889a683ce server side: misc stuff:
Goffi <goffi@goffi.org>
parents: 46
diff changeset
137 def onLogin(self, button):
66
9d8e79ac4c9c Login/Register box: integration of Adrien Vigneron's design
Goffi <goffi@goffi.org>
parents: 62
diff changeset
138 self.submit_type.setValue('login')
0
140cec48224a Initial commit
Goffi <goffi@goffi.org>
parents:
diff changeset
139 self.submit()
46
c3ee630914ba Account creation
Goffi <goffi@goffi.org>
parents: 43
diff changeset
140
62
12e889a683ce server side: misc stuff:
Goffi <goffi@goffi.org>
parents: 46
diff changeset
141 def onRegister(self, button):
67
b096facaa5b3 registration fix
Goffi <goffi@goffi.org>
parents: 66
diff changeset
142 if not re.match(r'^[a-z0-9_-]+$',self.register_login_box.getText(), re.IGNORECASE):
46
c3ee630914ba Account creation
Goffi <goffi@goffi.org>
parents: 43
diff changeset
143 self.warning_msg.setText('Invaling login, valid characters are a-z A-Z 0-9 _ -')
c3ee630914ba Account creation
Goffi <goffi@goffi.org>
parents: 43
diff changeset
144 self.warning_msg.setVisible(True)
c3ee630914ba Account creation
Goffi <goffi@goffi.org>
parents: 43
diff changeset
145 elif not re.match(r'^.+@.+\..+', self.email_box.getText(), re.IGNORECASE):
c3ee630914ba Account creation
Goffi <goffi@goffi.org>
parents: 43
diff changeset
146 self.warning_msg.setText('Invaling email address')
c3ee630914ba Account creation
Goffi <goffi@goffi.org>
parents: 43
diff changeset
147 self.warning_msg.setVisible(True)
c3ee630914ba Account creation
Goffi <goffi@goffi.org>
parents: 43
diff changeset
148 else:
c3ee630914ba Account creation
Goffi <goffi@goffi.org>
parents: 43
diff changeset
149 self.warning_msg.setVisible(False)
66
9d8e79ac4c9c Login/Register box: integration of Adrien Vigneron's design
Goffi <goffi@goffi.org>
parents: 62
diff changeset
150 self.submit_type.setValue('register')
46
c3ee630914ba Account creation
Goffi <goffi@goffi.org>
parents: 43
diff changeset
151 self.submit()
c3ee630914ba Account creation
Goffi <goffi@goffi.org>
parents: 43
diff changeset
152
0
140cec48224a Initial commit
Goffi <goffi@goffi.org>
parents:
diff changeset
153
140cec48224a Initial commit
Goffi <goffi@goffi.org>
parents:
diff changeset
154 def onSubmit(self, event):
140cec48224a Initial commit
Goffi <goffi@goffi.org>
parents:
diff changeset
155 pass
140cec48224a Initial commit
Goffi <goffi@goffi.org>
parents:
diff changeset
156
140cec48224a Initial commit
Goffi <goffi@goffi.org>
parents:
diff changeset
157 def onSubmitComplete(self, event):
140cec48224a Initial commit
Goffi <goffi@goffi.org>
parents:
diff changeset
158 result = event.getResults()
140cec48224a Initial commit
Goffi <goffi@goffi.org>
parents:
diff changeset
159 if result == "AUTH ERROR":
140cec48224a Initial commit
Goffi <goffi@goffi.org>
parents:
diff changeset
160 Window.alert('You login and/or password is incorrect. Please try again')
140cec48224a Initial commit
Goffi <goffi@goffi.org>
parents:
diff changeset
161 elif result == "LOGGED":
140cec48224a Initial commit
Goffi <goffi@goffi.org>
parents:
diff changeset
162 self.callback()
62
12e889a683ce server side: misc stuff:
Goffi <goffi@goffi.org>
parents: 46
diff changeset
163 elif result == "SESSION_ACTIVE":
12e889a683ce server side: misc stuff:
Goffi <goffi@goffi.org>
parents: 46
diff changeset
164 Window.alert('Session already active, this should not happen, please contact contact the author to fix it')
46
c3ee630914ba Account creation
Goffi <goffi@goffi.org>
parents: 43
diff changeset
165 elif result == "ALREADY EXISTS":
c3ee630914ba Account creation
Goffi <goffi@goffi.org>
parents: 43
diff changeset
166 self.warning_msg.setText('This login already exists, please choose an other one')
c3ee630914ba Account creation
Goffi <goffi@goffi.org>
parents: 43
diff changeset
167 self.warning_msg.setVisible(True)
c3ee630914ba Account creation
Goffi <goffi@goffi.org>
parents: 43
diff changeset
168 elif result == "REGISTRATION":
c3ee630914ba Account creation
Goffi <goffi@goffi.org>
parents: 43
diff changeset
169 self.warning_msg.setVisible(False)
67
b096facaa5b3 registration fix
Goffi <goffi@goffi.org>
parents: 66
diff changeset
170 self.login_box.setText(self.register_login_box.getText())
b096facaa5b3 registration fix
Goffi <goffi@goffi.org>
parents: 66
diff changeset
171 self.register_login_box.setText('')
66
9d8e79ac4c9c Login/Register box: integration of Adrien Vigneron's design
Goffi <goffi@goffi.org>
parents: 62
diff changeset
172 self.register_pass_box.setText('')
67
b096facaa5b3 registration fix
Goffi <goffi@goffi.org>
parents: 66
diff changeset
173 self.email_box.setText('')
b096facaa5b3 registration fix
Goffi <goffi@goffi.org>
parents: 66
diff changeset
174 self.right_side.selectTab(0)
46
c3ee630914ba Account creation
Goffi <goffi@goffi.org>
parents: 43
diff changeset
175 Window.alert('An email has been sent to you with your login informations\nPlease remember that this is ONLY A TECHNICAL DEMO')
0
140cec48224a Initial commit
Goffi <goffi@goffi.org>
parents:
diff changeset
176 else:
140cec48224a Initial commit
Goffi <goffi@goffi.org>
parents:
diff changeset
177 Window.alert('Submit error: %s' % result)
140cec48224a Initial commit
Goffi <goffi@goffi.org>
parents:
diff changeset
178
66
9d8e79ac4c9c Login/Register box: integration of Adrien Vigneron's design
Goffi <goffi@goffi.org>
parents: 62
diff changeset
179 class RegisterBox(PopupPanel):
0
140cec48224a Initial commit
Goffi <goffi@goffi.org>
parents:
diff changeset
180
140cec48224a Initial commit
Goffi <goffi@goffi.org>
parents:
diff changeset
181 def __init__(self, callback, *args,**kwargs):
66
9d8e79ac4c9c Login/Register box: integration of Adrien Vigneron's design
Goffi <goffi@goffi.org>
parents: 62
diff changeset
182 PopupPanel.__init__(self,*args,**kwargs)
0
140cec48224a Initial commit
Goffi <goffi@goffi.org>
parents:
diff changeset
183 _form = RegisterPanel(callback)
140cec48224a Initial commit
Goffi <goffi@goffi.org>
parents:
diff changeset
184 self.setWidget(_form)
66
9d8e79ac4c9c Login/Register box: integration of Adrien Vigneron's design
Goffi <goffi@goffi.org>
parents: 62
diff changeset
185
9d8e79ac4c9c Login/Register box: integration of Adrien Vigneron's design
Goffi <goffi@goffi.org>
parents: 62
diff changeset
186 def onWindowResized(self, width, height):
9d8e79ac4c9c Login/Register box: integration of Adrien Vigneron's design
Goffi <goffi@goffi.org>
parents: 62
diff changeset
187 super(RegisterBox, self).onWindowResized(width, height)
9d8e79ac4c9c Login/Register box: integration of Adrien Vigneron's design
Goffi <goffi@goffi.org>
parents: 62
diff changeset
188 self.centerBox()
9d8e79ac4c9c Login/Register box: integration of Adrien Vigneron's design
Goffi <goffi@goffi.org>
parents: 62
diff changeset
189
9d8e79ac4c9c Login/Register box: integration of Adrien Vigneron's design
Goffi <goffi@goffi.org>
parents: 62
diff changeset
190 def show(self):
9d8e79ac4c9c Login/Register box: integration of Adrien Vigneron's design
Goffi <goffi@goffi.org>
parents: 62
diff changeset
191 super(RegisterBox, self).show()
9d8e79ac4c9c Login/Register box: integration of Adrien Vigneron's design
Goffi <goffi@goffi.org>
parents: 62
diff changeset
192 self.centerBox()
9d8e79ac4c9c Login/Register box: integration of Adrien Vigneron's design
Goffi <goffi@goffi.org>
parents: 62
diff changeset
193