rev |
line source |
bsw@1071
|
1 local ldap_uid
|
bsw@1071
|
2
|
bsw@1071
|
3 if config.ldap.member and app.session.authority == "ldap" then
|
bsw@1071
|
4 ldap_uid = app.session.authority_data_uid
|
bsw@1071
|
5 end
|
bsw@1071
|
6
|
bsw@1071
|
7 if config.registration_disabled and not ldap_uid then
|
bsw@1071
|
8 error("registration disabled")
|
bsw@1071
|
9 end
|
bsw@1071
|
10
|
bsw@441
|
11 execute.view{ module = "index", view = "_lang_chooser" }
|
bsw@441
|
12
|
bsw@286
|
13 local step = param.get("step", atom.integer)
|
bsw/jbe@5
|
14 local code = param.get("code")
|
bsw/jbe@6
|
15 local notify_email = param.get("notify_email")
|
bsw/jbe@5
|
16 local name = param.get("name")
|
bsw/jbe@5
|
17 local login = param.get("login")
|
bsw/jbe@5
|
18
|
bsw@1071
|
19
|
bsw/jbe@5
|
20 ui.form{
|
bsw@1045
|
21 attr = { class = "section vertical" },
|
bsw/jbe@5
|
22 module = 'index',
|
bsw/jbe@5
|
23 action = 'register',
|
bsw/jbe@5
|
24 params = {
|
bsw/jbe@5
|
25 code = code,
|
bsw/jbe@6
|
26 notify_email = notify_email,
|
bsw/jbe@5
|
27 name = name,
|
bsw/jbe@5
|
28 login = login
|
bsw/jbe@5
|
29 },
|
bsw/jbe@5
|
30 content = function()
|
bsw/jbe@5
|
31
|
bsw@1071
|
32 if not code and not ldap_uid then
|
bsw@1045
|
33 ui.field.hidden{ name = "step", value = 1 }
|
bsw@743
|
34 ui.title(_"Registration (step 1 of 3: Invite code)")
|
bsw@1045
|
35 ui.sectionHead( function()
|
bsw@1045
|
36 ui.heading { level = 1, content = _"Please enter the invite code you've received" }
|
bsw@1045
|
37 end )
|
bsw@1045
|
38 ui.sectionRow( function()
|
bsw@1045
|
39 ui.field.text{
|
bsw@1045
|
40 label = _'Invite code',
|
bsw@1045
|
41 name = 'code',
|
bsw@1045
|
42 value = param.get("invite")
|
bsw@1045
|
43 }
|
bsw@1045
|
44 ui.submit{
|
bsw@1045
|
45 text = _'proceed with registration'
|
bsw@1045
|
46 }
|
bsw@1045
|
47 slot.put(" ")
|
bsw@742
|
48 ui.link{
|
bsw@1045
|
49 content = _"cancel registration",
|
bsw@742
|
50 module = "index",
|
bsw@1071
|
51 action = "cancel_register",
|
bsw@1071
|
52 routing = { default = {
|
bsw@1071
|
53 mode = "redirect", module = "index", view = "index"
|
bsw@1071
|
54 } }
|
bsw@742
|
55 }
|
bsw@1045
|
56 end )
|
bsw/jbe@5
|
57 else
|
bsw@1071
|
58 local member
|
bsw@1071
|
59
|
bsw@1071
|
60 if ldap_uid then
|
bsw@1071
|
61 member, err = ldap.create_member(ldap_uid, true)
|
bsw@1071
|
62 if err then
|
bsw@1071
|
63 error(err)
|
bsw@1071
|
64 end
|
bsw@1071
|
65 else
|
bsw@1071
|
66 member = Member:new_selector()
|
bsw@1071
|
67 :add_where{ "invite_code = ?", code }
|
bsw@1071
|
68 :add_where{ "activated ISNULL" }
|
bsw@1071
|
69 :optional_object_mode()
|
bsw@1071
|
70 :exec()
|
bsw@1071
|
71 end
|
bsw@286
|
72
|
bsw@1071
|
73 if (not member.notify_email and not notify_email)
|
bsw@1071
|
74 or (not member.name and not name)
|
bsw@1071
|
75 or (not member.login and not login and not member.authority)
|
bsw@1071
|
76 or step == 1 then
|
bsw@740
|
77 ui.title(_"Registration (step 2 of 3: Personal information)")
|
bsw@286
|
78 ui.field.hidden{ name = "step", value = 2 }
|
bsw@1045
|
79
|
bsw@1045
|
80 ui.sectionHead( function()
|
bsw@1045
|
81 ui.heading { level = 1, content = _"Check and enter personal data" }
|
bsw@1045
|
82 end )
|
bsw@1045
|
83 ui.sectionRow( function()
|
bsw@1045
|
84 ui.tag{
|
bsw@1045
|
85 tag = "p",
|
bsw@1045
|
86 content = _"This invite key is connected with the following information:"
|
bsw@1045
|
87 }
|
bsw@1045
|
88
|
bsw@1045
|
89 execute.view{ module = "member", view = "_profile", params = { member = member, for_registration = true } }
|
bsw@1045
|
90
|
bsw@1071
|
91 if not util.is_profile_field_locked(member, "notify_email") then
|
bsw@1045
|
92 ui.tag{
|
bsw@1045
|
93 tag = "p",
|
bsw@1045
|
94 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@1045
|
95 }
|
bsw@1045
|
96 ui.field.text{
|
bsw@1045
|
97 label = _'Email address',
|
bsw@1045
|
98 name = 'notify_email',
|
bsw@1045
|
99 value = param.get("notify_email") or member.notify_email
|
bsw@1045
|
100 }
|
bsw@1045
|
101 end
|
bsw@1071
|
102 if not util.is_profile_field_locked(member, "name") then
|
bsw@1045
|
103 ui.tag{
|
bsw@1045
|
104 tag = "p",
|
bsw@1045
|
105 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@1045
|
106 }
|
bsw@1045
|
107 ui.field.text{
|
bsw@1045
|
108 label = _'Screen name',
|
bsw@1045
|
109 name = 'name',
|
bsw@1045
|
110 value = param.get("name") or member.name
|
bsw@1045
|
111 }
|
bsw@1045
|
112 end
|
bsw@1071
|
113 if not util.is_profile_field_locked(member, "login") then
|
bsw@1045
|
114 ui.tag{
|
bsw@1045
|
115 tag = "p",
|
bsw@1045
|
116 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@1045
|
117 }
|
bsw@1045
|
118 ui.field.text{
|
bsw@1045
|
119 label = _'Login name',
|
bsw@1045
|
120 name = 'login',
|
bsw@1045
|
121 value = param.get("login") or member.login
|
bsw@1045
|
122 }
|
bsw@1045
|
123 end
|
bsw@1045
|
124 ui.submit{
|
bsw@1045
|
125 text = _'proceed with registration'
|
bsw@1045
|
126 }
|
bsw@1045
|
127 slot.put(" ")
|
bsw@286
|
128 ui.link{
|
bsw@1045
|
129 content = _"one step back",
|
bsw@745
|
130 module = "index",
|
bsw@745
|
131 view = "register",
|
bsw@745
|
132 params = {
|
bsw@750
|
133 invite = code
|
bsw@745
|
134 }
|
bsw@745
|
135 }
|
bsw@1045
|
136 slot.put(" ")
|
bsw@745
|
137 ui.link{
|
bsw@1045
|
138 content = _"cancel registration",
|
bsw@742
|
139 module = "index",
|
bsw@1071
|
140 action = "cancel_register",
|
bsw@1071
|
141 routing = { default = {
|
bsw@1071
|
142 mode = "redirect", module = "index", view = "index"
|
bsw@1071
|
143 } }
|
bsw@742
|
144 }
|
bsw@1045
|
145 end )
|
bsw@286
|
146 else
|
bsw@286
|
147
|
bsw@286
|
148 ui.field.hidden{ name = "step", value = "3" }
|
bsw@740
|
149 ui.title(_"Registration (step 3 of 3: Terms of use and password)")
|
bsw@1045
|
150 ui.sectionHead( function()
|
bsw@1045
|
151 ui.heading { level = 1, content = _"Read and accept the terms and choose a password" }
|
bsw@1045
|
152 end )
|
bsw@1045
|
153 ui.sectionRow( function()
|
bsw@1045
|
154 ui.container{
|
bsw@1045
|
155 attr = { class = "wiki use_terms" },
|
bsw@286
|
156 content = function()
|
bsw@1045
|
157 slot.put(config.use_terms)
|
bsw@1045
|
158 end
|
bsw@1045
|
159 }
|
bsw@1045
|
160
|
bsw@1045
|
161 member.notify_email = notify_email or member.notify_email
|
bsw@1045
|
162 member.name = name or member.name
|
bsw@1045
|
163 member.login = login or member.login
|
bsw@1045
|
164
|
bsw@1045
|
165 execute.view{ module = "member", view = "_profile", params = {
|
bsw@1045
|
166 member = member, include_private_data = true
|
bsw@1045
|
167 } }
|
bsw@1045
|
168
|
bsw@1045
|
169 for i, checkbox in ipairs(config.use_terms_checkboxes) do
|
bsw@1045
|
170 slot.put("<br />")
|
bsw@1045
|
171 ui.tag{
|
bsw@1045
|
172 tag = "div",
|
bsw@1045
|
173 content = function()
|
bsw@1045
|
174 ui.tag{
|
bsw@1045
|
175 tag = "input",
|
bsw@1045
|
176 attr = {
|
bsw@1045
|
177 type = "checkbox",
|
bsw@1045
|
178 id = "use_terms_checkbox_" .. checkbox.name,
|
bsw@1045
|
179 name = "use_terms_checkbox_" .. checkbox.name,
|
bsw@1045
|
180 value = "1",
|
bsw@1045
|
181 style = "float: left;",
|
bsw@1045
|
182 checked = param.get("use_terms_checkbox_" .. checkbox.name, atom.boolean) and "checked" or nil
|
bsw@1045
|
183 }
|
bsw@1045
|
184 }
|
bsw@1045
|
185 slot.put(" ")
|
bsw@1045
|
186 ui.tag{
|
bsw@1045
|
187 tag = "label",
|
bsw@1045
|
188 attr = { ['for'] = "use_terms_checkbox_" .. checkbox.name },
|
bsw@1045
|
189 content = function() slot.put(checkbox.html) end
|
bsw@1045
|
190 }
|
bsw@1045
|
191 end
|
bsw@1045
|
192 }
|
bsw@1045
|
193 end
|
bsw@1045
|
194
|
bsw@1045
|
195 slot.put("<br />")
|
bsw@1045
|
196
|
bsw@1071
|
197 if not member.authority == "ldap" then
|
bsw@1071
|
198 ui.tag{
|
bsw@1071
|
199 tag = "p",
|
bsw@1071
|
200 content = _"Please choose a password and enter it twice. The password is case sensitive."
|
bsw@1071
|
201 }
|
bsw@1071
|
202 ui.field.text{
|
bsw@1071
|
203 readonly = true,
|
bsw@1071
|
204 label = _'Login name',
|
bsw@1071
|
205 name = 'login',
|
bsw@1071
|
206 value = member.login
|
bsw@1071
|
207 }
|
bsw@1071
|
208 ui.field.password{
|
bsw@1071
|
209 label = _'Password',
|
bsw@1071
|
210 name = 'password1',
|
bsw@1071
|
211 }
|
bsw@1071
|
212 ui.field.password{
|
bsw@1071
|
213 label = _'Password (repeat)',
|
bsw@1071
|
214 name = 'password2',
|
bsw@1071
|
215 }
|
bsw@1071
|
216 end
|
bsw@1071
|
217
|
bsw@1045
|
218 ui.submit{
|
bsw@1045
|
219 text = _'activate account'
|
bsw@1045
|
220 }
|
bsw@1045
|
221 slot.put(" ")
|
bsw@1045
|
222 ui.link{
|
bsw@1045
|
223 content = _"one step back",
|
bsw@286
|
224 module = "index",
|
bsw@286
|
225 view = "register",
|
bsw@286
|
226 params = {
|
bsw@286
|
227 code = code,
|
bsw@286
|
228 notify_email = notify_email,
|
bsw@286
|
229 name = name,
|
bsw@286
|
230 login = login,
|
bsw@286
|
231 step = 1
|
bsw@286
|
232 }
|
bsw@286
|
233 }
|
bsw@1045
|
234 slot.put(" ")
|
bsw@742
|
235 ui.link{
|
bsw@1045
|
236 content = _"cancel registration",
|
bsw@742
|
237 module = "index",
|
bsw@1071
|
238 action = "cancel_register",
|
bsw@1071
|
239 routing = { default = {
|
bsw@1071
|
240 mode = "redirect", module = "index", view = "index"
|
bsw@1071
|
241 } }
|
bsw@742
|
242 }
|
bsw@1045
|
243 end )
|
bsw@286
|
244 end
|
bsw/jbe@5
|
245 end
|
bsw/jbe@5
|
246 end
|
bsw/jbe@5
|
247 }
|
bsw/jbe@5
|
248
|
bsw/jbe@5
|
249
|