annotate src/browser/sat_browser/register.py @ 898:2d15b484ca33

blog, browser: updated imports to reflect renaming of common.py to common/data_format.py
author Goffi <goffi@goffi.org>
date Tue, 22 Mar 2016 22:45:39 +0100
parents 0d719b6a4115
children 22fe06569b1a
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
339
2067d6241927 fixed docstrings wrong usage for licence informations
Goffi <goffi@goffi.org>
parents: 249
diff changeset
4 # Libervia: a Salut à Toi frontend
818
f8a7a046ff9c copyright update
Goffi <goffi@goffi.org>
parents: 804
diff changeset
5 # Copyright (C) 2011-2016 Jérôme Poisson <goffi@goffi.org>
339
2067d6241927 fixed docstrings wrong usage for licence informations
Goffi <goffi@goffi.org>
parents: 249
diff changeset
6 # Copyright (C) 2011, 2012 Adrien Vigneron <adrienvigneron@mailoo.org>
0
140cec48224a Initial commit
Goffi <goffi@goffi.org>
parents:
diff changeset
7
339
2067d6241927 fixed docstrings wrong usage for licence informations
Goffi <goffi@goffi.org>
parents: 249
diff changeset
8 # This program is free software: you can redistribute it and/or modify
2067d6241927 fixed docstrings wrong usage for licence informations
Goffi <goffi@goffi.org>
parents: 249
diff changeset
9 # it under the terms of the GNU Affero General Public License as published by
2067d6241927 fixed docstrings wrong usage for licence informations
Goffi <goffi@goffi.org>
parents: 249
diff changeset
10 # the Free Software Foundation, either version 3 of the License, or
2067d6241927 fixed docstrings wrong usage for licence informations
Goffi <goffi@goffi.org>
parents: 249
diff changeset
11 # (at your option) any later version.
0
140cec48224a Initial commit
Goffi <goffi@goffi.org>
parents:
diff changeset
12
339
2067d6241927 fixed docstrings wrong usage for licence informations
Goffi <goffi@goffi.org>
parents: 249
diff changeset
13 # This program is distributed in the hope that it will be useful,
2067d6241927 fixed docstrings wrong usage for licence informations
Goffi <goffi@goffi.org>
parents: 249
diff changeset
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
2067d6241927 fixed docstrings wrong usage for licence informations
Goffi <goffi@goffi.org>
parents: 249
diff changeset
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2067d6241927 fixed docstrings wrong usage for licence informations
Goffi <goffi@goffi.org>
parents: 249
diff changeset
16 # GNU Affero General Public License for more details.
0
140cec48224a Initial commit
Goffi <goffi@goffi.org>
parents:
diff changeset
17
339
2067d6241927 fixed docstrings wrong usage for licence informations
Goffi <goffi@goffi.org>
parents: 249
diff changeset
18 # You should have received a copy of the GNU Affero General Public License
2067d6241927 fixed docstrings wrong usage for licence informations
Goffi <goffi@goffi.org>
parents: 249
diff changeset
19 # along with this program. If not, see <http://www.gnu.org/licenses/>.
0
140cec48224a Initial commit
Goffi <goffi@goffi.org>
parents:
diff changeset
20
140cec48224a Initial commit
Goffi <goffi@goffi.org>
parents:
diff changeset
21 #This page manage subscription and new account creation
140cec48224a Initial commit
Goffi <goffi@goffi.org>
parents:
diff changeset
22
451
1a0cec9b0f1e better PEP-8 compliance
souliane <souliane@mailoo.org>
parents: 449
diff changeset
23 import pyjd # this is dummy in pyjs
445
c0ff91cabea0 server_side, browser_side: new account password must contain at least 6 chars + cosmetic change for register warning message
souliane <souliane@mailoo.org>
parents: 442
diff changeset
24 from sat.core.i18n import _
449
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents: 445
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
729
273b39f04d8e browser_side: change login and register panels (makes it more visible and less confusing)
souliane <souliane@mailoo.org>
parents: 685
diff changeset
29 from pyjamas.ui.StackPanel import StackPanel
0
140cec48224a Initial commit
Goffi <goffi@goffi.org>
parents:
diff changeset
30 from pyjamas.ui.PasswordTextBox import PasswordTextBox
140cec48224a Initial commit
Goffi <goffi@goffi.org>
parents:
diff changeset
31 from pyjamas.ui.TextBox import TextBox
140cec48224a Initial commit
Goffi <goffi@goffi.org>
parents:
diff changeset
32 from pyjamas.ui.FormPanel import FormPanel
140cec48224a Initial commit
Goffi <goffi@goffi.org>
parents:
diff changeset
33 from pyjamas.ui.Button import Button
46
c3ee630914ba Account creation
Goffi <goffi@goffi.org>
parents: 43
diff changeset
34 from pyjamas.ui.Label import Label
445
c0ff91cabea0 server_side, browser_side: new account password must contain at least 6 chars + cosmetic change for register warning message
souliane <souliane@mailoo.org>
parents: 442
diff changeset
35 from pyjamas.ui.HTML import HTML
66
9d8e79ac4c9c Login/Register box: integration of Adrien Vigneron's design
Goffi <goffi@goffi.org>
parents: 62
diff changeset
36 from pyjamas.ui.PopupPanel import PopupPanel
9d8e79ac4c9c Login/Register box: integration of Adrien Vigneron's design
Goffi <goffi@goffi.org>
parents: 62
diff changeset
37 from pyjamas.ui.Image import Image
9d8e79ac4c9c Login/Register box: integration of Adrien Vigneron's design
Goffi <goffi@goffi.org>
parents: 62
diff changeset
38 from pyjamas.ui.Hidden import Hidden
0
140cec48224a Initial commit
Goffi <goffi@goffi.org>
parents:
diff changeset
39 from pyjamas import Window
422
20c508f9b32a browser side: fixed bad use of Timer
Goffi <goffi@goffi.org>
parents: 382
diff changeset
40 from pyjamas.ui.KeyboardListener import KEY_ENTER
449
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents: 445
diff changeset
41 from pyjamas.Timer import Timer
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents: 445
diff changeset
42
848
7dafa5ee809a browser: replace re module usage by pure javascript
souliane <souliane@mailoo.org>
parents: 818
diff changeset
43 from __pyjamas__ import JS
449
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents: 445
diff changeset
44
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents: 445
diff changeset
45 from constants import Const as C
0
140cec48224a Initial commit
Goffi <goffi@goffi.org>
parents:
diff changeset
46
140cec48224a Initial commit
Goffi <goffi@goffi.org>
parents:
diff changeset
47
795
a6b39838353f browser_side: inform the user that entering a full JID in the login box is only needed for external XMPP account
souliane <souliane@mailoo.org>
parents: 793
diff changeset
48
0
140cec48224a Initial commit
Goffi <goffi@goffi.org>
parents:
diff changeset
49 class RegisterPanel(FormPanel):
140cec48224a Initial commit
Goffi <goffi@goffi.org>
parents:
diff changeset
50
871
54f6c5b86a87 server, browser: new "allow_registration" option to enable/disable new account registration through Liberia interface
Goffi <goffi@goffi.org>
parents: 851
diff changeset
51 def __init__(self, callback, session_data):
0
140cec48224a Initial commit
Goffi <goffi@goffi.org>
parents:
diff changeset
52 """
871
54f6c5b86a87 server, browser: new "allow_registration" option to enable/disable new account registration through Liberia interface
Goffi <goffi@goffi.org>
parents: 851
diff changeset
53 @param callback(callable): method to call if login successful
54f6c5b86a87 server, browser: new "allow_registration" option to enable/disable new account registration through Liberia interface
Goffi <goffi@goffi.org>
parents: 851
diff changeset
54 @param session_data(dict): session metadata
0
140cec48224a Initial commit
Goffi <goffi@goffi.org>
parents:
diff changeset
55 """
140cec48224a Initial commit
Goffi <goffi@goffi.org>
parents:
diff changeset
56 FormPanel.__init__(self)
66
9d8e79ac4c9c Login/Register box: integration of Adrien Vigneron's design
Goffi <goffi@goffi.org>
parents: 62
diff changeset
57 self.setSize('600px', '350px')
0
140cec48224a Initial commit
Goffi <goffi@goffi.org>
parents:
diff changeset
58 self.callback = callback
140cec48224a Initial commit
Goffi <goffi@goffi.org>
parents:
diff changeset
59 self.setMethod(FormPanel.METHOD_POST)
66
9d8e79ac4c9c Login/Register box: integration of Adrien Vigneron's design
Goffi <goffi@goffi.org>
parents: 62
diff changeset
60 main_panel = HorizontalPanel()
9d8e79ac4c9c Login/Register box: integration of Adrien Vigneron's design
Goffi <goffi@goffi.org>
parents: 62
diff changeset
61 main_panel.setStyleName('registerPanel_main')
77
975e6be24e11 media paths update
Goffi <goffi@goffi.org>
parents: 67
diff changeset
62 left_side = Image("media/libervia/register_left.png")
66
9d8e79ac4c9c Login/Register box: integration of Adrien Vigneron's design
Goffi <goffi@goffi.org>
parents: 62
diff changeset
63 main_panel.add(left_side)
9d8e79ac4c9c Login/Register box: integration of Adrien Vigneron's design
Goffi <goffi@goffi.org>
parents: 62
diff changeset
64
729
273b39f04d8e browser_side: change login and register panels (makes it more visible and less confusing)
souliane <souliane@mailoo.org>
parents: 685
diff changeset
65 ##StackPanel##
273b39f04d8e browser_side: change login and register panels (makes it more visible and less confusing)
souliane <souliane@mailoo.org>
parents: 685
diff changeset
66 self.right_side = StackPanel(StyleName='registerPanel_right_side')
67
b096facaa5b3 registration fix
Goffi <goffi@goffi.org>
parents: 66
diff changeset
67 main_panel.add(self.right_side)
b096facaa5b3 registration fix
Goffi <goffi@goffi.org>
parents: 66
diff changeset
68 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
69
729
273b39f04d8e browser_side: change login and register panels (makes it more visible and less confusing)
souliane <souliane@mailoo.org>
parents: 685
diff changeset
70 ##Login stack##
273b39f04d8e browser_side: change login and register panels (makes it more visible and less confusing)
souliane <souliane@mailoo.org>
parents: 685
diff changeset
71 login_stack = SimplePanel()
273b39f04d8e browser_side: change login and register panels (makes it more visible and less confusing)
souliane <souliane@mailoo.org>
parents: 685
diff changeset
72 login_stack.setStyleName('registerPanel_content')
66
9d8e79ac4c9c Login/Register box: integration of Adrien Vigneron's design
Goffi <goffi@goffi.org>
parents: 62
diff changeset
73 login_vpanel = VerticalPanel()
729
273b39f04d8e browser_side: change login and register panels (makes it more visible and less confusing)
souliane <souliane@mailoo.org>
parents: 685
diff changeset
74 login_stack.setWidget(login_vpanel)
216
9827cda1a6b0 browser_side: added key listener to login and register panels
souliane <souliane@mailoo.org>
parents: 173
diff changeset
75
729
273b39f04d8e browser_side: change login and register panels (makes it more visible and less confusing)
souliane <souliane@mailoo.org>
parents: 685
diff changeset
76 self.login_warning_msg = HTML('')
161
03ac7f51a35b browser side: fixed registration:
Goffi <goffi@goffi.org>
parents: 131
diff changeset
77 self.login_warning_msg.setStyleName('formWarning')
03ac7f51a35b browser side: fixed registration:
Goffi <goffi@goffi.org>
parents: 131
diff changeset
78 login_vpanel.add(self.login_warning_msg)
46
c3ee630914ba Account creation
Goffi <goffi@goffi.org>
parents: 43
diff changeset
79
66
9d8e79ac4c9c Login/Register box: integration of Adrien Vigneron's design
Goffi <goffi@goffi.org>
parents: 62
diff changeset
80 login_label = Label('Login:')
46
c3ee630914ba Account creation
Goffi <goffi@goffi.org>
parents: 43
diff changeset
81 self.login_box = TextBox()
c3ee630914ba Account creation
Goffi <goffi@goffi.org>
parents: 43
diff changeset
82 self.login_box.setName("login")
216
9827cda1a6b0 browser_side: added key listener to login and register panels
souliane <souliane@mailoo.org>
parents: 173
diff changeset
83 self.login_box.addKeyboardListener(self)
66
9d8e79ac4c9c Login/Register box: integration of Adrien Vigneron's design
Goffi <goffi@goffi.org>
parents: 62
diff changeset
84 login_pass_label = Label('Password:')
216
9827cda1a6b0 browser_side: added key listener to login and register panels
souliane <souliane@mailoo.org>
parents: 173
diff changeset
85 self.login_pass_box = PasswordTextBox()
9827cda1a6b0 browser_side: added key listener to login and register panels
souliane <souliane@mailoo.org>
parents: 173
diff changeset
86 self.login_pass_box.setName("login_password")
9827cda1a6b0 browser_side: added key listener to login and register panels
souliane <souliane@mailoo.org>
parents: 173
diff changeset
87 self.login_pass_box.addKeyboardListener(self)
9827cda1a6b0 browser_side: added key listener to login and register panels
souliane <souliane@mailoo.org>
parents: 173
diff changeset
88
66
9d8e79ac4c9c Login/Register box: integration of Adrien Vigneron's design
Goffi <goffi@goffi.org>
parents: 62
diff changeset
89 login_vpanel.add(login_label)
9d8e79ac4c9c Login/Register box: integration of Adrien Vigneron's design
Goffi <goffi@goffi.org>
parents: 62
diff changeset
90 login_vpanel.add(self.login_box)
9d8e79ac4c9c Login/Register box: integration of Adrien Vigneron's design
Goffi <goffi@goffi.org>
parents: 62
diff changeset
91 login_vpanel.add(login_pass_label)
216
9827cda1a6b0 browser_side: added key listener to login and register panels
souliane <souliane@mailoo.org>
parents: 173
diff changeset
92 login_vpanel.add(self.login_pass_box)
66
9d8e79ac4c9c Login/Register box: integration of Adrien Vigneron's design
Goffi <goffi@goffi.org>
parents: 62
diff changeset
93 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
94 login_but.setStyleName('button')
9d8e79ac4c9c Login/Register box: integration of Adrien Vigneron's design
Goffi <goffi@goffi.org>
parents: 62
diff changeset
95 login_but.addStyleName('red')
9d8e79ac4c9c Login/Register box: integration of Adrien Vigneron's design
Goffi <goffi@goffi.org>
parents: 62
diff changeset
96 login_vpanel.add(login_but)
871
54f6c5b86a87 server, browser: new "allow_registration" option to enable/disable new account registration through Liberia interface
Goffi <goffi@goffi.org>
parents: 851
diff changeset
97 self.right_side.add(login_stack, 'Return to the login screen')
66
9d8e79ac4c9c Login/Register box: integration of Adrien Vigneron's design
Goffi <goffi@goffi.org>
parents: 62
diff changeset
98
9d8e79ac4c9c Login/Register box: integration of Adrien Vigneron's design
Goffi <goffi@goffi.org>
parents: 62
diff changeset
99 #The hidden submit_type field
9d8e79ac4c9c Login/Register box: integration of Adrien Vigneron's design
Goffi <goffi@goffi.org>
parents: 62
diff changeset
100 self.submit_type = Hidden('submit_type')
9d8e79ac4c9c Login/Register box: integration of Adrien Vigneron's design
Goffi <goffi@goffi.org>
parents: 62
diff changeset
101 login_vpanel.add(self.submit_type)
9d8e79ac4c9c Login/Register box: integration of Adrien Vigneron's design
Goffi <goffi@goffi.org>
parents: 62
diff changeset
102
729
273b39f04d8e browser_side: change login and register panels (makes it more visible and less confusing)
souliane <souliane@mailoo.org>
parents: 685
diff changeset
103 ##Register stack##
871
54f6c5b86a87 server, browser: new "allow_registration" option to enable/disable new account registration through Liberia interface
Goffi <goffi@goffi.org>
parents: 851
diff changeset
104 if session_data["allow_registration"]:
54f6c5b86a87 server, browser: new "allow_registration" option to enable/disable new account registration through Liberia interface
Goffi <goffi@goffi.org>
parents: 851
diff changeset
105 register_stack = SimplePanel()
54f6c5b86a87 server, browser: new "allow_registration" option to enable/disable new account registration through Liberia interface
Goffi <goffi@goffi.org>
parents: 851
diff changeset
106 register_stack.setStyleName('registerPanel_content')
54f6c5b86a87 server, browser: new "allow_registration" option to enable/disable new account registration through Liberia interface
Goffi <goffi@goffi.org>
parents: 851
diff changeset
107 register_vpanel = VerticalPanel()
54f6c5b86a87 server, browser: new "allow_registration" option to enable/disable new account registration through Liberia interface
Goffi <goffi@goffi.org>
parents: 851
diff changeset
108 register_stack.setWidget(register_vpanel)
216
9827cda1a6b0 browser_side: added key listener to login and register panels
souliane <souliane@mailoo.org>
parents: 173
diff changeset
109
871
54f6c5b86a87 server, browser: new "allow_registration" option to enable/disable new account registration through Liberia interface
Goffi <goffi@goffi.org>
parents: 851
diff changeset
110 self.register_warning_msg = HTML('')
54f6c5b86a87 server, browser: new "allow_registration" option to enable/disable new account registration through Liberia interface
Goffi <goffi@goffi.org>
parents: 851
diff changeset
111 self.register_warning_msg.setStyleName('formWarning')
54f6c5b86a87 server, browser: new "allow_registration" option to enable/disable new account registration through Liberia interface
Goffi <goffi@goffi.org>
parents: 851
diff changeset
112 register_vpanel.add(self.register_warning_msg)
216
9827cda1a6b0 browser_side: added key listener to login and register panels
souliane <souliane@mailoo.org>
parents: 173
diff changeset
113
871
54f6c5b86a87 server, browser: new "allow_registration" option to enable/disable new account registration through Liberia interface
Goffi <goffi@goffi.org>
parents: 851
diff changeset
114 register_login_label = Label('Login:')
54f6c5b86a87 server, browser: new "allow_registration" option to enable/disable new account registration through Liberia interface
Goffi <goffi@goffi.org>
parents: 851
diff changeset
115 self.register_login_box = TextBox()
54f6c5b86a87 server, browser: new "allow_registration" option to enable/disable new account registration through Liberia interface
Goffi <goffi@goffi.org>
parents: 851
diff changeset
116 self.register_login_box.setName("register_login")
54f6c5b86a87 server, browser: new "allow_registration" option to enable/disable new account registration through Liberia interface
Goffi <goffi@goffi.org>
parents: 851
diff changeset
117 self.register_login_box.addKeyboardListener(self)
54f6c5b86a87 server, browser: new "allow_registration" option to enable/disable new account registration through Liberia interface
Goffi <goffi@goffi.org>
parents: 851
diff changeset
118 email_label = Label('E-mail:')
54f6c5b86a87 server, browser: new "allow_registration" option to enable/disable new account registration through Liberia interface
Goffi <goffi@goffi.org>
parents: 851
diff changeset
119 self.email_box = TextBox()
54f6c5b86a87 server, browser: new "allow_registration" option to enable/disable new account registration through Liberia interface
Goffi <goffi@goffi.org>
parents: 851
diff changeset
120 self.email_box.setName("email")
54f6c5b86a87 server, browser: new "allow_registration" option to enable/disable new account registration through Liberia interface
Goffi <goffi@goffi.org>
parents: 851
diff changeset
121 self.email_box.addKeyboardListener(self)
54f6c5b86a87 server, browser: new "allow_registration" option to enable/disable new account registration through Liberia interface
Goffi <goffi@goffi.org>
parents: 851
diff changeset
122 register_pass_label = Label('Password:')
54f6c5b86a87 server, browser: new "allow_registration" option to enable/disable new account registration through Liberia interface
Goffi <goffi@goffi.org>
parents: 851
diff changeset
123 self.register_pass_box = PasswordTextBox()
54f6c5b86a87 server, browser: new "allow_registration" option to enable/disable new account registration through Liberia interface
Goffi <goffi@goffi.org>
parents: 851
diff changeset
124 self.register_pass_box.setName("register_password")
54f6c5b86a87 server, browser: new "allow_registration" option to enable/disable new account registration through Liberia interface
Goffi <goffi@goffi.org>
parents: 851
diff changeset
125 self.register_pass_box.addKeyboardListener(self)
54f6c5b86a87 server, browser: new "allow_registration" option to enable/disable new account registration through Liberia interface
Goffi <goffi@goffi.org>
parents: 851
diff changeset
126 register_vpanel.add(register_login_label)
54f6c5b86a87 server, browser: new "allow_registration" option to enable/disable new account registration through Liberia interface
Goffi <goffi@goffi.org>
parents: 851
diff changeset
127 register_vpanel.add(self.register_login_box)
54f6c5b86a87 server, browser: new "allow_registration" option to enable/disable new account registration through Liberia interface
Goffi <goffi@goffi.org>
parents: 851
diff changeset
128 register_vpanel.add(email_label)
54f6c5b86a87 server, browser: new "allow_registration" option to enable/disable new account registration through Liberia interface
Goffi <goffi@goffi.org>
parents: 851
diff changeset
129 register_vpanel.add(self.email_box)
54f6c5b86a87 server, browser: new "allow_registration" option to enable/disable new account registration through Liberia interface
Goffi <goffi@goffi.org>
parents: 851
diff changeset
130 register_vpanel.add(register_pass_label)
54f6c5b86a87 server, browser: new "allow_registration" option to enable/disable new account registration through Liberia interface
Goffi <goffi@goffi.org>
parents: 851
diff changeset
131 register_vpanel.add(self.register_pass_box)
216
9827cda1a6b0 browser_side: added key listener to login and register panels
souliane <souliane@mailoo.org>
parents: 173
diff changeset
132
871
54f6c5b86a87 server, browser: new "allow_registration" option to enable/disable new account registration through Liberia interface
Goffi <goffi@goffi.org>
parents: 851
diff changeset
133 register_but = Button("Register a new account", getattr(self, "onRegister"))
54f6c5b86a87 server, browser: new "allow_registration" option to enable/disable new account registration through Liberia interface
Goffi <goffi@goffi.org>
parents: 851
diff changeset
134 register_but.setStyleName('button')
54f6c5b86a87 server, browser: new "allow_registration" option to enable/disable new account registration through Liberia interface
Goffi <goffi@goffi.org>
parents: 851
diff changeset
135 register_but.addStyleName('red')
54f6c5b86a87 server, browser: new "allow_registration" option to enable/disable new account registration through Liberia interface
Goffi <goffi@goffi.org>
parents: 851
diff changeset
136 register_vpanel.add(register_but)
216
9827cda1a6b0 browser_side: added key listener to login and register panels
souliane <souliane@mailoo.org>
parents: 173
diff changeset
137
871
54f6c5b86a87 server, browser: new "allow_registration" option to enable/disable new account registration through Liberia interface
Goffi <goffi@goffi.org>
parents: 851
diff changeset
138 self.right_side.add(register_stack, 'No account yet? Create a new one!')
54f6c5b86a87 server, browser: new "allow_registration" option to enable/disable new account registration through Liberia interface
Goffi <goffi@goffi.org>
parents: 851
diff changeset
139 self.right_side.addStackChangeListener(self)
54f6c5b86a87 server, browser: new "allow_registration" option to enable/disable new account registration through Liberia interface
Goffi <goffi@goffi.org>
parents: 851
diff changeset
140 register_stack.setWidth(None)
729
273b39f04d8e browser_side: change login and register panels (makes it more visible and less confusing)
souliane <souliane@mailoo.org>
parents: 685
diff changeset
141 login_stack.setWidth(None)
216
9827cda1a6b0 browser_side: added key listener to login and register panels
souliane <souliane@mailoo.org>
parents: 173
diff changeset
142
66
9d8e79ac4c9c Login/Register box: integration of Adrien Vigneron's design
Goffi <goffi@goffi.org>
parents: 62
diff changeset
143 self.add(main_panel)
0
140cec48224a Initial commit
Goffi <goffi@goffi.org>
parents:
diff changeset
144 self.addFormHandler(self)
140cec48224a Initial commit
Goffi <goffi@goffi.org>
parents:
diff changeset
145 self.setAction('register_api/login')
140cec48224a Initial commit
Goffi <goffi@goffi.org>
parents:
diff changeset
146
729
273b39f04d8e browser_side: change login and register panels (makes it more visible and less confusing)
souliane <souliane@mailoo.org>
parents: 685
diff changeset
147 def onStackChanged(self, sender, index):
273b39f04d8e browser_side: change login and register panels (makes it more visible and less confusing)
souliane <souliane@mailoo.org>
parents: 685
diff changeset
148 if index == 0:
222
759fd7386e1e browser_side: set the focus to the first field when a tab is selected from the register panel
souliane <souliane@mailoo.org>
parents: 216
diff changeset
149 self.login_box.setFocus(True)
729
273b39f04d8e browser_side: change login and register panels (makes it more visible and less confusing)
souliane <souliane@mailoo.org>
parents: 685
diff changeset
150 elif index == 1:
222
759fd7386e1e browser_side: set the focus to the first field when a tab is selected from the register panel
souliane <souliane@mailoo.org>
parents: 216
diff changeset
151 self.register_login_box.setFocus(True)
759fd7386e1e browser_side: set the focus to the first field when a tab is selected from the register panel
souliane <souliane@mailoo.org>
parents: 216
diff changeset
152
216
9827cda1a6b0 browser_side: added key listener to login and register panels
souliane <souliane@mailoo.org>
parents: 173
diff changeset
153 def onKeyPress(self, sender, keycode, modifiers):
795
a6b39838353f browser_side: inform the user that entering a full JID in the login box is only needed for external XMPP account
souliane <souliane@mailoo.org>
parents: 793
diff changeset
154 # XXX: this is triggered before the textbox value has changed
216
9827cda1a6b0 browser_side: added key listener to login and register panels
souliane <souliane@mailoo.org>
parents: 173
diff changeset
155 if keycode == KEY_ENTER:
237
531b8809d1ab browser_side: fixed browser built-in auto-completion in login/register panels
souliane <souliane@mailoo.org>
parents: 222
diff changeset
156 # Browsers offer an auto-completion feature to any
531b8809d1ab browser_side: fixed browser built-in auto-completion in login/register panels
souliane <souliane@mailoo.org>
parents: 222
diff changeset
157 # text box, but the selected value is not set when
531b8809d1ab browser_side: fixed browser built-in auto-completion in login/register panels
souliane <souliane@mailoo.org>
parents: 222
diff changeset
158 # the widget looses the focus. Using a timer with
531b8809d1ab browser_side: fixed browser built-in auto-completion in login/register panels
souliane <souliane@mailoo.org>
parents: 222
diff changeset
159 # any delay value > 0 would do the trick.
216
9827cda1a6b0 browser_side: added key listener to login and register panels
souliane <souliane@mailoo.org>
parents: 173
diff changeset
160 if sender == self.login_box:
422
20c508f9b32a browser side: fixed bad use of Timer
Goffi <goffi@goffi.org>
parents: 382
diff changeset
161 Timer(5, lambda timer: self.login_pass_box.setFocus(True))
216
9827cda1a6b0 browser_side: added key listener to login and register panels
souliane <souliane@mailoo.org>
parents: 173
diff changeset
162 elif sender == self.login_pass_box:
9827cda1a6b0 browser_side: added key listener to login and register panels
souliane <souliane@mailoo.org>
parents: 173
diff changeset
163 self.onLogin(None)
9827cda1a6b0 browser_side: added key listener to login and register panels
souliane <souliane@mailoo.org>
parents: 173
diff changeset
164 elif sender == self.register_login_box:
422
20c508f9b32a browser side: fixed bad use of Timer
Goffi <goffi@goffi.org>
parents: 382
diff changeset
165 Timer(5, lambda timer: self.email_box.setFocus(True))
216
9827cda1a6b0 browser_side: added key listener to login and register panels
souliane <souliane@mailoo.org>
parents: 173
diff changeset
166 elif sender == self.email_box:
422
20c508f9b32a browser side: fixed bad use of Timer
Goffi <goffi@goffi.org>
parents: 382
diff changeset
167 Timer(5, lambda timer: self.register_pass_box.setFocus(True))
216
9827cda1a6b0 browser_side: added key listener to login and register panels
souliane <souliane@mailoo.org>
parents: 173
diff changeset
168 elif sender == self.register_pass_box:
9827cda1a6b0 browser_side: added key listener to login and register panels
souliane <souliane@mailoo.org>
parents: 173
diff changeset
169 self.onRegister(None)
9827cda1a6b0 browser_side: added key listener to login and register panels
souliane <souliane@mailoo.org>
parents: 173
diff changeset
170
9827cda1a6b0 browser_side: added key listener to login and register panels
souliane <souliane@mailoo.org>
parents: 173
diff changeset
171 def onKeyUp(self, sender, keycode, modifiers):
795
a6b39838353f browser_side: inform the user that entering a full JID in the login box is only needed for external XMPP account
souliane <souliane@mailoo.org>
parents: 793
diff changeset
172 # XXX: this is triggered after the textbox value has changed
a6b39838353f browser_side: inform the user that entering a full JID in the login box is only needed for external XMPP account
souliane <souliane@mailoo.org>
parents: 793
diff changeset
173 if sender == self.login_box:
804
1f054ba3245e browser_side: fixes JID as login detection, can't rely on "@" keycode
souliane <souliane@mailoo.org>
parents: 798
diff changeset
174 if "@" in self.login_box.getText():
795
a6b39838353f browser_side: inform the user that entering a full JID in the login box is only needed for external XMPP account
souliane <souliane@mailoo.org>
parents: 793
diff changeset
175 self.login_warning_msg.setHTML(_('<span class="formInfo">Entering a full JID is only needed to connect with an external XMPP account.</span>'))
804
1f054ba3245e browser_side: fixes JID as login detection, can't rely on "@" keycode
souliane <souliane@mailoo.org>
parents: 798
diff changeset
176 else:
795
a6b39838353f browser_side: inform the user that entering a full JID in the login box is only needed for external XMPP account
souliane <souliane@mailoo.org>
parents: 793
diff changeset
177 self.login_warning_msg.setHTML("")
216
9827cda1a6b0 browser_side: added key listener to login and register panels
souliane <souliane@mailoo.org>
parents: 173
diff changeset
178
9827cda1a6b0 browser_side: added key listener to login and register panels
souliane <souliane@mailoo.org>
parents: 173
diff changeset
179 def onKeyDown(self, sender, keycode, modifiers):
9827cda1a6b0 browser_side: added key listener to login and register panels
souliane <souliane@mailoo.org>
parents: 173
diff changeset
180 pass
9827cda1a6b0 browser_side: added key listener to login and register panels
souliane <souliane@mailoo.org>
parents: 173
diff changeset
181
62
12e889a683ce server side: misc stuff:
Goffi <goffi@goffi.org>
parents: 46
diff changeset
182 def onLogin(self, button):
848
7dafa5ee809a browser: replace re module usage by pure javascript
souliane <souliane@mailoo.org>
parents: 818
diff changeset
183 if not self.checkJID(self.login_box.getText()):
750
8ac862f6e5b3 browser and server sides: allow to connect with a JID that is not registered on the local server
souliane <souliane@mailoo.org>
parents: 729
diff changeset
184 self.login_warning_msg.setHTML('Invalid login, valid characters<br>are a-z A-Z 0-9 _ - or a bare JID')
173
3d998119237e browser side: added login characters check in login panel (similar to the one in register panel)
Goffi <goffi@goffi.org>
parents: 165
diff changeset
185 else:
3d998119237e browser side: added login characters check in login panel (similar to the one in register panel)
Goffi <goffi@goffi.org>
parents: 165
diff changeset
186 self.submit_type.setValue('login')
589
a5019e62c3e9 browser side: big refactoring to base Libervia on QuickFrontend, first draft:
Goffi <goffi@goffi.org>
parents: 487
diff changeset
187 self.submit(None)
46
c3ee630914ba Account creation
Goffi <goffi@goffi.org>
parents: 43
diff changeset
188
62
12e889a683ce server side: misc stuff:
Goffi <goffi@goffi.org>
parents: 46
diff changeset
189 def onRegister(self, button):
487
e588335b6aa8 browser and server side: force lower case for the profile name at new account creation + fixes CSS for textarea
souliane <souliane@mailoo.org>
parents: 481
diff changeset
190 # XXX: for now libervia forces the creation to lower case
e588335b6aa8 browser and server side: force lower case for the profile name at new account creation + fixes CSS for textarea
souliane <souliane@mailoo.org>
parents: 481
diff changeset
191 self.register_login_box.setText(self.register_login_box.getText().lower())
848
7dafa5ee809a browser: replace re module usage by pure javascript
souliane <souliane@mailoo.org>
parents: 818
diff changeset
192 if not self.checkLogin(self.register_login_box.getText()):
445
c0ff91cabea0 server_side, browser_side: new account password must contain at least 6 chars + cosmetic change for register warning message
souliane <souliane@mailoo.org>
parents: 442
diff changeset
193 self.register_warning_msg.setHTML(_('Invalid login, valid characters<br>are a-z A-Z 0-9 _ -'))
848
7dafa5ee809a browser: replace re module usage by pure javascript
souliane <souliane@mailoo.org>
parents: 818
diff changeset
194 elif not self.checkEmail(self.email_box.getText()):
851
77a494f13118 browser (register): improve some regex after Link Mauve's comments:
souliane <souliane@mailoo.org>
parents: 848
diff changeset
195 self.register_warning_msg.setHTML(_('Invalid email address<br>(or not accepted yet)'))
445
c0ff91cabea0 server_side, browser_side: new account password must contain at least 6 chars + cosmetic change for register warning message
souliane <souliane@mailoo.org>
parents: 442
diff changeset
196 elif len(self.register_pass_box.getText()) < C.PASSWORD_MIN_LENGTH:
729
273b39f04d8e browser_side: change login and register panels (makes it more visible and less confusing)
souliane <souliane@mailoo.org>
parents: 685
diff changeset
197 self.register_warning_msg.setHTML(_('Your password must contain<br>at least %d characters.') % C.PASSWORD_MIN_LENGTH)
46
c3ee630914ba Account creation
Goffi <goffi@goffi.org>
parents: 43
diff changeset
198 else:
729
273b39f04d8e browser_side: change login and register panels (makes it more visible and less confusing)
souliane <souliane@mailoo.org>
parents: 685
diff changeset
199 self.register_warning_msg.setHTML("")
66
9d8e79ac4c9c Login/Register box: integration of Adrien Vigneron's design
Goffi <goffi@goffi.org>
parents: 62
diff changeset
200 self.submit_type.setValue('register')
589
a5019e62c3e9 browser side: big refactoring to base Libervia on QuickFrontend, first draft:
Goffi <goffi@goffi.org>
parents: 487
diff changeset
201 self.submit(None)
46
c3ee630914ba Account creation
Goffi <goffi@goffi.org>
parents: 43
diff changeset
202
0
140cec48224a Initial commit
Goffi <goffi@goffi.org>
parents:
diff changeset
203 def onSubmit(self, event):
140cec48224a Initial commit
Goffi <goffi@goffi.org>
parents:
diff changeset
204 pass
140cec48224a Initial commit
Goffi <goffi@goffi.org>
parents:
diff changeset
205
140cec48224a Initial commit
Goffi <goffi@goffi.org>
parents:
diff changeset
206 def onSubmitComplete(self, event):
140cec48224a Initial commit
Goffi <goffi@goffi.org>
parents:
diff changeset
207 result = event.getResults()
481
bbdc5357dc00 browser and server sides: refactor HTTP request result values + handle "NoReply" error
souliane <souliane@mailoo.org>
parents: 467
diff changeset
208 if result == C.PROFILE_AUTH_ERROR:
729
273b39f04d8e browser_side: change login and register panels (makes it more visible and less confusing)
souliane <souliane@mailoo.org>
parents: 685
diff changeset
209 self.login_warning_msg.setHTML(_('Your login and/or password is incorrect. Please try again.'))
481
bbdc5357dc00 browser and server sides: refactor HTTP request result values + handle "NoReply" error
souliane <souliane@mailoo.org>
parents: 467
diff changeset
210 elif result == C.XMPP_AUTH_ERROR:
464
bea9788f3170 browser and server sides: don't handle the "connectionError" signal anymore, we now use asyncConnect errback:
souliane <souliane@mailoo.org>
parents: 451
diff changeset
211 # TODO: call stdui action CHANGE_XMPP_PASSWD_ID as it's done in primitivus
888
0d719b6a4115 browser (register): update message when XMPP connection failed
souliane <souliane@mailoo.org>
parents: 871
diff changeset
212 Window.alert(_(u'Your XMPP account failed to connect. Did you enter the good password? If you have changed your XMPP password since your last connection on Libervia, please use another SàT frontend to update your profile.'))
796
fad9c9f82ae3 browser and server sides: alert the user after he created a new profile using his XMPP account credentials
souliane <souliane@mailoo.org>
parents: 795
diff changeset
213 elif result == C.PROFILE_LOGGED_REGISTERED_WITH_EXT_JID:
798
3c5b17a3d86e browser_side: run login callback before window alert so the background starts to be filled before the user clicks
souliane <souliane@mailoo.org>
parents: 796
diff changeset
214 self.callback()
796
fad9c9f82ae3 browser and server sides: alert the user after he created a new profile using his XMPP account credentials
souliane <souliane@mailoo.org>
parents: 795
diff changeset
215 Window.alert(_('A profile has been created on this Libervia service using your existing XMPP account. Since you are not using our XMPP server, we can not guaranty that all the extra features (blog, directory...) will fully work.'))
481
bbdc5357dc00 browser and server sides: refactor HTTP request result values + handle "NoReply" error
souliane <souliane@mailoo.org>
parents: 467
diff changeset
216 elif result == C.PROFILE_LOGGED:
0
140cec48224a Initial commit
Goffi <goffi@goffi.org>
parents:
diff changeset
217 self.callback()
481
bbdc5357dc00 browser and server sides: refactor HTTP request result values + handle "NoReply" error
souliane <souliane@mailoo.org>
parents: 467
diff changeset
218 elif result == C.SESSION_ACTIVE:
729
273b39f04d8e browser_side: change login and register panels (makes it more visible and less confusing)
souliane <souliane@mailoo.org>
parents: 685
diff changeset
219 Window.alert(_('Session already active, this should not happen, please contact the author to fix it.'))
481
bbdc5357dc00 browser and server sides: refactor HTTP request result values + handle "NoReply" error
souliane <souliane@mailoo.org>
parents: 467
diff changeset
220 elif result == C.NO_REPLY:
729
273b39f04d8e browser_side: change login and register panels (makes it more visible and less confusing)
souliane <souliane@mailoo.org>
parents: 685
diff changeset
221 Window.alert(_("Did not receive a reply (the timeout expired or the connection is broken)."))
481
bbdc5357dc00 browser and server sides: refactor HTTP request result values + handle "NoReply" error
souliane <souliane@mailoo.org>
parents: 467
diff changeset
222 elif result == C.ALREADY_EXISTS:
729
273b39f04d8e browser_side: change login and register panels (makes it more visible and less confusing)
souliane <souliane@mailoo.org>
parents: 685
diff changeset
223 self.register_warning_msg.setHTML(_('This login already exists,<br>please choose another one.'))
481
bbdc5357dc00 browser and server sides: refactor HTTP request result values + handle "NoReply" error
souliane <souliane@mailoo.org>
parents: 467
diff changeset
224 elif result == C.INTERNAL_ERROR:
729
273b39f04d8e browser_side: change login and register panels (makes it more visible and less confusing)
souliane <souliane@mailoo.org>
parents: 685
diff changeset
225 self.register_warning_msg.setHTML(_('An registration error occurred, please contact the server administrator.'))
481
bbdc5357dc00 browser and server sides: refactor HTTP request result values + handle "NoReply" error
souliane <souliane@mailoo.org>
parents: 467
diff changeset
226 elif result == C.REGISTRATION_SUCCEED:
729
273b39f04d8e browser_side: change login and register panels (makes it more visible and less confusing)
souliane <souliane@mailoo.org>
parents: 685
diff changeset
227 self.login_warning_msg.setHTML("")
273b39f04d8e browser_side: change login and register panels (makes it more visible and less confusing)
souliane <souliane@mailoo.org>
parents: 685
diff changeset
228 self.register_warning_msg.setHTML("")
67
b096facaa5b3 registration fix
Goffi <goffi@goffi.org>
parents: 66
diff changeset
229 self.login_box.setText(self.register_login_box.getText())
445
c0ff91cabea0 server_side, browser_side: new account password must contain at least 6 chars + cosmetic change for register warning message
souliane <souliane@mailoo.org>
parents: 442
diff changeset
230 self.login_pass_box.setText('')
67
b096facaa5b3 registration fix
Goffi <goffi@goffi.org>
parents: 66
diff changeset
231 self.register_login_box.setText('')
66
9d8e79ac4c9c Login/Register box: integration of Adrien Vigneron's design
Goffi <goffi@goffi.org>
parents: 62
diff changeset
232 self.register_pass_box.setText('')
67
b096facaa5b3 registration fix
Goffi <goffi@goffi.org>
parents: 66
diff changeset
233 self.email_box.setText('')
729
273b39f04d8e browser_side: change login and register panels (makes it more visible and less confusing)
souliane <souliane@mailoo.org>
parents: 685
diff changeset
234 self.right_side.showStack(0)
382
06fbe6055925 browser_side: focus the password input after account creation
souliane <souliane@mailoo.org>
parents: 340
diff changeset
235 self.login_pass_box.setFocus(True)
729
273b39f04d8e browser_side: change login and register panels (makes it more visible and less confusing)
souliane <souliane@mailoo.org>
parents: 685
diff changeset
236 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
237 else:
793
249e49f56f67 browser and server sides: removed constant UNMANAGED_FAULT_STRING which is used only to be displayed to the user, but it doesn't mean anything to him
souliane <souliane@mailoo.org>
parents: 750
diff changeset
238 Window.alert(_("An error occurred and we couldn't process your request. Please report the following error name to the administrators of your network: '%s'" % result))
0
140cec48224a Initial commit
Goffi <goffi@goffi.org>
parents:
diff changeset
239
848
7dafa5ee809a browser: replace re module usage by pure javascript
souliane <souliane@mailoo.org>
parents: 818
diff changeset
240 def checkLogin(self, text):
7dafa5ee809a browser: replace re module usage by pure javascript
souliane <souliane@mailoo.org>
parents: 818
diff changeset
241 """Check if the given text is a valid login
7dafa5ee809a browser: replace re module usage by pure javascript
souliane <souliane@mailoo.org>
parents: 818
diff changeset
242
7dafa5ee809a browser: replace re module usage by pure javascript
souliane <souliane@mailoo.org>
parents: 818
diff changeset
243 @param text (unicode)
7dafa5ee809a browser: replace re module usage by pure javascript
souliane <souliane@mailoo.org>
parents: 818
diff changeset
244 @return bool
7dafa5ee809a browser: replace re module usage by pure javascript
souliane <souliane@mailoo.org>
parents: 818
diff changeset
245 """
7dafa5ee809a browser: replace re module usage by pure javascript
souliane <souliane@mailoo.org>
parents: 818
diff changeset
246 # FIXME: Pyjamas re module is not stable so we use pure JS instead
851
77a494f13118 browser (register): improve some regex after Link Mauve's comments:
souliane <souliane@mailoo.org>
parents: 848
diff changeset
247 # FIXME: login is restricted to this regex until we fix the account creation
848
7dafa5ee809a browser: replace re module usage by pure javascript
souliane <souliane@mailoo.org>
parents: 818
diff changeset
248 JS("""return /^(\w|-)+$/.test(text);""")
7dafa5ee809a browser: replace re module usage by pure javascript
souliane <souliane@mailoo.org>
parents: 818
diff changeset
249
7dafa5ee809a browser: replace re module usage by pure javascript
souliane <souliane@mailoo.org>
parents: 818
diff changeset
250 def checkEmail(self, text):
7dafa5ee809a browser: replace re module usage by pure javascript
souliane <souliane@mailoo.org>
parents: 818
diff changeset
251 """Check if the given text is a valid email address.
7dafa5ee809a browser: replace re module usage by pure javascript
souliane <souliane@mailoo.org>
parents: 818
diff changeset
252
7dafa5ee809a browser: replace re module usage by pure javascript
souliane <souliane@mailoo.org>
parents: 818
diff changeset
253 @param text (unicode)
7dafa5ee809a browser: replace re module usage by pure javascript
souliane <souliane@mailoo.org>
parents: 818
diff changeset
254 @return bool
7dafa5ee809a browser: replace re module usage by pure javascript
souliane <souliane@mailoo.org>
parents: 818
diff changeset
255 """
7dafa5ee809a browser: replace re module usage by pure javascript
souliane <souliane@mailoo.org>
parents: 818
diff changeset
256 # FIXME: Pyjamas re module is not stable so we use pure JS instead
851
77a494f13118 browser (register): improve some regex after Link Mauve's comments:
souliane <souliane@mailoo.org>
parents: 848
diff changeset
257 # FIXME: send a message to validate the email instead of using a bad regex
77a494f13118 browser (register): improve some regex after Link Mauve's comments:
souliane <souliane@mailoo.org>
parents: 848
diff changeset
258 JS("""return /^(\w|-|\.|\+)+@(\w|-)+\.(\w|-)+$/.test(text);""")
848
7dafa5ee809a browser: replace re module usage by pure javascript
souliane <souliane@mailoo.org>
parents: 818
diff changeset
259
7dafa5ee809a browser: replace re module usage by pure javascript
souliane <souliane@mailoo.org>
parents: 818
diff changeset
260 def checkJID(self, text):
7dafa5ee809a browser: replace re module usage by pure javascript
souliane <souliane@mailoo.org>
parents: 818
diff changeset
261 """Check if the given text is a valid JID.
7dafa5ee809a browser: replace re module usage by pure javascript
souliane <souliane@mailoo.org>
parents: 818
diff changeset
262
7dafa5ee809a browser: replace re module usage by pure javascript
souliane <souliane@mailoo.org>
parents: 818
diff changeset
263 @param text (unicode)
7dafa5ee809a browser: replace re module usage by pure javascript
souliane <souliane@mailoo.org>
parents: 818
diff changeset
264 @return bool
7dafa5ee809a browser: replace re module usage by pure javascript
souliane <souliane@mailoo.org>
parents: 818
diff changeset
265 """
7dafa5ee809a browser: replace re module usage by pure javascript
souliane <souliane@mailoo.org>
parents: 818
diff changeset
266 # FIXME: Pyjamas re module is not stable so we use pure JS instead
851
77a494f13118 browser (register): improve some regex after Link Mauve's comments:
souliane <souliane@mailoo.org>
parents: 848
diff changeset
267 # FIXME: this regex is too restrictive for people using external XMPP account
77a494f13118 browser (register): improve some regex after Link Mauve's comments:
souliane <souliane@mailoo.org>
parents: 848
diff changeset
268 JS("""return /^(\w|-|\.|\+)+(@(\w|-)+\.(\w|-)+)?$/.test(text);""")
848
7dafa5ee809a browser: replace re module usage by pure javascript
souliane <souliane@mailoo.org>
parents: 818
diff changeset
269
222
759fd7386e1e browser_side: set the focus to the first field when a tab is selected from the register panel
souliane <souliane@mailoo.org>
parents: 216
diff changeset
270
66
9d8e79ac4c9c Login/Register box: integration of Adrien Vigneron's design
Goffi <goffi@goffi.org>
parents: 62
diff changeset
271 class RegisterBox(PopupPanel):
0
140cec48224a Initial commit
Goffi <goffi@goffi.org>
parents:
diff changeset
272
871
54f6c5b86a87 server, browser: new "allow_registration" option to enable/disable new account registration through Liberia interface
Goffi <goffi@goffi.org>
parents: 851
diff changeset
273 def __init__(self, callback, session_data, *args, **kwargs):
222
759fd7386e1e browser_side: set the focus to the first field when a tab is selected from the register panel
souliane <souliane@mailoo.org>
parents: 216
diff changeset
274 PopupPanel.__init__(self, *args, **kwargs)
871
54f6c5b86a87 server, browser: new "allow_registration" option to enable/disable new account registration through Liberia interface
Goffi <goffi@goffi.org>
parents: 851
diff changeset
275 self._form = RegisterPanel(callback, session_data)
222
759fd7386e1e browser_side: set the focus to the first field when a tab is selected from the register panel
souliane <souliane@mailoo.org>
parents: 216
diff changeset
276 self.setWidget(self._form)
759fd7386e1e browser_side: set the focus to the first field when a tab is selected from the register panel
souliane <souliane@mailoo.org>
parents: 216
diff changeset
277
66
9d8e79ac4c9c Login/Register box: integration of Adrien Vigneron's design
Goffi <goffi@goffi.org>
parents: 62
diff changeset
278 def onWindowResized(self, width, height):
9d8e79ac4c9c Login/Register box: integration of Adrien Vigneron's design
Goffi <goffi@goffi.org>
parents: 62
diff changeset
279 super(RegisterBox, self).onWindowResized(width, height)
9d8e79ac4c9c Login/Register box: integration of Adrien Vigneron's design
Goffi <goffi@goffi.org>
parents: 62
diff changeset
280 self.centerBox()
9d8e79ac4c9c Login/Register box: integration of Adrien Vigneron's design
Goffi <goffi@goffi.org>
parents: 62
diff changeset
281
9d8e79ac4c9c Login/Register box: integration of Adrien Vigneron's design
Goffi <goffi@goffi.org>
parents: 62
diff changeset
282 def show(self):
9d8e79ac4c9c Login/Register box: integration of Adrien Vigneron's design
Goffi <goffi@goffi.org>
parents: 62
diff changeset
283 super(RegisterBox, self).show()
9d8e79ac4c9c Login/Register box: integration of Adrien Vigneron's design
Goffi <goffi@goffi.org>
parents: 62
diff changeset
284 self.centerBox()
222
759fd7386e1e browser_side: set the focus to the first field when a tab is selected from the register panel
souliane <souliane@mailoo.org>
parents: 216
diff changeset
285 self._form.login_box.setFocus(True)