rev |
line source |
bsw@441
|
1 execute.view{ module = "index", view = "_lang_chooser" }
|
bsw@441
|
2
|
bsw@286
|
3 local step = param.get("step", atom.integer)
|
bsw/jbe@5
|
4 local code = param.get("code")
|
bsw/jbe@6
|
5 local notify_email = param.get("notify_email")
|
bsw/jbe@5
|
6 local name = param.get("name")
|
bsw/jbe@5
|
7 local login = param.get("login")
|
bsw/jbe@5
|
8
|
bsw/jbe@5
|
9 ui.form{
|
bsw/jbe@6
|
10 attr = { class = "vertical" },
|
bsw/jbe@5
|
11 module = 'index',
|
bsw/jbe@5
|
12 action = 'register',
|
bsw/jbe@5
|
13 params = {
|
bsw/jbe@5
|
14 code = code,
|
bsw/jbe@6
|
15 notify_email = notify_email,
|
bsw/jbe@5
|
16 name = name,
|
bsw/jbe@5
|
17 login = login
|
bsw/jbe@5
|
18 },
|
bsw/jbe@5
|
19 content = function()
|
bsw/jbe@5
|
20
|
bsw/jbe@5
|
21 if not code then
|
bsw@743
|
22 ui.title(_"Registration (step 1 of 3: Invite code)")
|
bsw@742
|
23 ui.actions(function()
|
bsw@742
|
24 ui.link{
|
bsw@742
|
25 content = function()
|
bsw@742
|
26 slot.put(_"One step back")
|
bsw@742
|
27 end,
|
bsw@742
|
28 module = "index",
|
bsw@742
|
29 view = "register",
|
bsw@742
|
30 params = {
|
bsw@742
|
31 }
|
bsw@742
|
32 }
|
bsw@743
|
33 slot.put(" · ")
|
bsw@742
|
34 ui.link{
|
bsw@742
|
35 content = function()
|
bsw@742
|
36 slot.put(_"Cancel registration")
|
bsw@742
|
37 end,
|
bsw@742
|
38 module = "index",
|
bsw@742
|
39 view = "index"
|
bsw@742
|
40 }
|
bsw@742
|
41 end)
|
bsw@286
|
42 ui.field.hidden{ name = "step", value = 1 }
|
bsw/jbe@5
|
43 ui.tag{
|
bsw/jbe@5
|
44 tag = "p",
|
bsw/jbe@5
|
45 content = _"Please enter the invite code you've received."
|
bsw/jbe@5
|
46 }
|
bsw/jbe@5
|
47 ui.field.text{
|
bsw@286
|
48 label = _'Invite code',
|
bsw@286
|
49 name = 'code',
|
bsw/jbe@6
|
50 value = param.get("invite")
|
bsw/jbe@6
|
51 }
|
bsw/jbe@6
|
52
|
bsw/jbe@5
|
53 else
|
bsw@286
|
54 local member = Member:new_selector()
|
bsw@286
|
55 :add_where{ "invite_code = ?", code }
|
bsw@286
|
56 :add_where{ "activated ISNULL" }
|
bsw@286
|
57 :optional_object_mode()
|
bsw@286
|
58 :for_update()
|
bsw@286
|
59 :exec()
|
bsw@286
|
60
|
bsw@286
|
61 if not member.notify_email and not notify_email or not member.name and not name or not member.login and not login or step == 1 then
|
bsw@740
|
62 ui.title(_"Registration (step 2 of 3: Personal information)")
|
bsw@286
|
63 ui.field.hidden{ name = "step", value = 2 }
|
bsw@741
|
64 ui.actions(function()
|
bsw@286
|
65 ui.link{
|
bsw@286
|
66 content = function()
|
bsw@742
|
67 slot.put(_"Cancel registration")
|
bsw@742
|
68 end,
|
bsw@742
|
69 module = "index",
|
bsw@742
|
70 view = "index"
|
bsw@742
|
71 }
|
bsw@286
|
72 end)
|
bsw@286
|
73
|
bsw@286
|
74 ui.tag{
|
bsw@286
|
75 tag = "p",
|
bsw@286
|
76 content = _"This invite key is connected with the following information:"
|
bsw/jbe@6
|
77 }
|
bsw@286
|
78
|
bsw@286
|
79 execute.view{ module = "member", view = "_profile", params = { member = member, include_private_data = true } }
|
bsw@79
|
80
|
bsw@286
|
81 if not config.locked_profile_fields.notify_email then
|
bsw@286
|
82 ui.tag{
|
bsw@286
|
83 tag = "p",
|
bsw@286
|
84 content = _"Please enter your email address. This address will be used for automatic notifications (if you request them) and in case you've lost your password. This address will not be published. After registration you will receive an email with a confirmation link."
|
bsw@286
|
85 }
|
bsw@286
|
86 ui.field.text{
|
bsw@286
|
87 label = _'Email address',
|
bsw@286
|
88 name = 'notify_email',
|
bsw@286
|
89 value = param.get("notify_email") or member.notify_email
|
bsw@286
|
90 }
|
bsw@286
|
91 end
|
bsw@286
|
92 if not config.locked_profile_fields.name then
|
bsw@286
|
93 ui.tag{
|
bsw@286
|
94 tag = "p",
|
bsw@286
|
95 content = _"Please choose a name, i.e. your real name or your nick name. This name will be shown to others to identify you."
|
bsw@286
|
96 }
|
bsw@286
|
97 ui.field.text{
|
bsw@286
|
98 label = _'Screen name',
|
bsw@286
|
99 name = 'name',
|
bsw@286
|
100 value = param.get("name") or member.name
|
bsw@286
|
101 }
|
bsw@286
|
102 end
|
bsw@286
|
103 if not config.locked_profile_fields.login then
|
bsw@286
|
104 ui.tag{
|
bsw@286
|
105 tag = "p",
|
bsw@286
|
106 content = _"Please choose a login name. This name will not be shown to others and is used only by you to login into the system. The login name is case sensitive."
|
bsw@286
|
107 }
|
bsw@286
|
108 ui.field.text{
|
bsw@286
|
109 label = _'Login name',
|
bsw@286
|
110 name = 'login',
|
bsw@286
|
111 value = param.get("login") or member.login
|
bsw@286
|
112 }
|
bsw@286
|
113 end
|
bsw@286
|
114 else
|
bsw@286
|
115
|
bsw@286
|
116 ui.field.hidden{ name = "step", value = "3" }
|
bsw@740
|
117 ui.title(_"Registration (step 3 of 3: Terms of use and password)")
|
bsw@741
|
118 ui.actions(function()
|
bsw@286
|
119 ui.link{
|
bsw@286
|
120 content = function()
|
bsw@286
|
121 slot.put(_"One step back")
|
bsw@286
|
122 end,
|
bsw@286
|
123 module = "index",
|
bsw@286
|
124 view = "register",
|
bsw@286
|
125 params = {
|
bsw@286
|
126 code = code,
|
bsw@286
|
127 notify_email = notify_email,
|
bsw@286
|
128 name = name,
|
bsw@286
|
129 login = login,
|
bsw@286
|
130 step = 1
|
bsw@286
|
131 }
|
bsw@286
|
132 }
|
bsw@743
|
133 slot.put(" · ")
|
bsw@742
|
134 ui.link{
|
bsw@742
|
135 content = function()
|
bsw@742
|
136 slot.put(_"Cancel registration")
|
bsw@742
|
137 end,
|
bsw@742
|
138 module = "index",
|
bsw@742
|
139 view = "index"
|
bsw@742
|
140 }
|
bsw@286
|
141 end)
|
bsw@286
|
142 ui.container{
|
bsw@286
|
143 attr = { class = "wiki use_terms" },
|
bsw@79
|
144 content = function()
|
bsw@286
|
145 if config.use_terms_html then
|
bsw@286
|
146 slot.put(config.use_terms_html)
|
bsw@286
|
147 else
|
bsw@286
|
148 slot.put(format.wiki_text(config.use_terms))
|
bsw@286
|
149 end
|
bsw@79
|
150 end
|
bsw@79
|
151 }
|
bsw@79
|
152
|
bsw@739
|
153 member.notify_email = notify_email or member.notify_email
|
bsw@739
|
154 member.name = name or member.name
|
bsw@739
|
155 member.login = login or member.login
|
bsw@739
|
156
|
bsw@739
|
157 execute.view{ module = "member", view = "_profile", params = {
|
bsw@739
|
158 member = member, include_private_data = true
|
bsw@739
|
159 } }
|
bsw@739
|
160
|
bsw@286
|
161 for i, checkbox in ipairs(config.use_terms_checkboxes) do
|
bsw@286
|
162 slot.put("<br />")
|
bsw@286
|
163 ui.tag{
|
bsw@286
|
164 tag = "div",
|
bsw@286
|
165 content = function()
|
bsw@286
|
166 ui.tag{
|
bsw@286
|
167 tag = "input",
|
bsw@286
|
168 attr = {
|
bsw@286
|
169 type = "checkbox",
|
bsw@398
|
170 id = "use_terms_checkbox_" .. checkbox.name,
|
bsw@286
|
171 name = "use_terms_checkbox_" .. checkbox.name,
|
bsw@286
|
172 value = "1",
|
bsw@286
|
173 style = "float: left;",
|
bsw@286
|
174 checked = param.get("use_terms_checkbox_" .. checkbox.name, atom.boolean) and "checked" or nil
|
bsw@286
|
175 }
|
bsw@286
|
176 }
|
bsw@286
|
177 slot.put(" ")
|
bsw@398
|
178 ui.tag{
|
bsw@398
|
179 tag = "label",
|
bsw@398
|
180 attr = { ['for'] = "use_terms_checkbox_" .. checkbox.name },
|
bsw@398
|
181 content = function() slot.put(checkbox.html) end
|
bsw@398
|
182 }
|
bsw@286
|
183 end
|
bsw@286
|
184 }
|
bsw@286
|
185 end
|
bsw@79
|
186
|
bsw@286
|
187 slot.put("<br />")
|
bsw/jbe@6
|
188
|
bsw@286
|
189 ui.tag{
|
bsw@286
|
190 tag = "p",
|
bsw@286
|
191 content = _"Please choose a password and enter it twice. The password is case sensitive."
|
bsw@286
|
192 }
|
bsw@286
|
193 ui.field.password{
|
bsw@286
|
194 label = _'Password',
|
bsw@286
|
195 name = 'password1',
|
bsw@286
|
196 }
|
bsw@286
|
197 ui.field.password{
|
bsw@286
|
198 label = _'Password (repeat)',
|
bsw@286
|
199 name = 'password2',
|
bsw@286
|
200 }
|
bsw/jbe@5
|
201
|
bsw@286
|
202 end
|
bsw/jbe@5
|
203 end
|
bsw/jbe@5
|
204
|
bsw@286
|
205 ui.submit{
|
bsw@740
|
206 text = _'Create account'
|
bsw@286
|
207 }
|
bsw/jbe@5
|
208 end
|
bsw/jbe@5
|
209 }
|
bsw/jbe@5
|
210
|
bsw/jbe@5
|
211
|