liquid_feedback_frontend
view app/main/index/register.lua @ 1045:701a5cf6b067
Imported LiquidFeedback Frontend 3.0 branch
| author | bsw |
|---|---|
| date | Thu Jul 10 01:19:48 2014 +0200 (2014-07-10) |
| parents | 03b0ac783fe0 |
| children | 58f48a8a202a |
line source
1 execute.view{ module = "index", view = "_lang_chooser" }
3 local step = param.get("step", atom.integer)
4 local code = param.get("code")
5 local notify_email = param.get("notify_email")
6 local name = param.get("name")
7 local login = param.get("login")
9 ui.form{
10 attr = { class = "section vertical" },
11 module = 'index',
12 action = 'register',
13 params = {
14 code = code,
15 notify_email = notify_email,
16 name = name,
17 login = login
18 },
19 content = function()
21 if not code then
22 ui.field.hidden{ name = "step", value = 1 }
23 ui.title(_"Registration (step 1 of 3: Invite code)")
24 ui.sectionHead( function()
25 ui.heading { level = 1, content = _"Please enter the invite code you've received" }
26 end )
27 ui.sectionRow( function()
28 ui.field.text{
29 label = _'Invite code',
30 name = 'code',
31 value = param.get("invite")
32 }
33 ui.submit{
34 text = _'proceed with registration'
35 }
36 slot.put(" ")
37 ui.link{
38 content = _"cancel registration",
39 module = "index",
40 view = "index"
41 }
42 end )
43 else
44 local member = Member:new_selector()
45 :add_where{ "invite_code = ?", code }
46 :add_where{ "activated ISNULL" }
47 :optional_object_mode()
48 :exec()
50 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
51 ui.title(_"Registration (step 2 of 3: Personal information)")
52 ui.field.hidden{ name = "step", value = 2 }
54 ui.sectionHead( function()
55 ui.heading { level = 1, content = _"Check and enter personal data" }
56 end )
57 ui.sectionRow( function()
58 ui.tag{
59 tag = "p",
60 content = _"This invite key is connected with the following information:"
61 }
63 execute.view{ module = "member", view = "_profile", params = { member = member, for_registration = true } }
65 if not config.locked_profile_fields.notify_email then
66 ui.tag{
67 tag = "p",
68 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."
69 }
70 ui.field.text{
71 label = _'Email address',
72 name = 'notify_email',
73 value = param.get("notify_email") or member.notify_email
74 }
75 end
76 if not config.locked_profile_fields.name then
77 ui.tag{
78 tag = "p",
79 content = _"Please choose a name, i.e. your real name or your nick name. This name will be shown to others to identify you."
80 }
81 ui.field.text{
82 label = _'Screen name',
83 name = 'name',
84 value = param.get("name") or member.name
85 }
86 end
87 if not config.locked_profile_fields.login then
88 ui.tag{
89 tag = "p",
90 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."
91 }
92 ui.field.text{
93 label = _'Login name',
94 name = 'login',
95 value = param.get("login") or member.login
96 }
97 end
98 ui.submit{
99 text = _'proceed with registration'
100 }
101 slot.put(" ")
102 ui.link{
103 content = _"one step back",
104 module = "index",
105 view = "register",
106 params = {
107 invite = code
108 }
109 }
110 slot.put(" ")
111 ui.link{
112 content = _"cancel registration",
113 module = "index",
114 view = "index"
115 }
116 end )
117 else
119 ui.field.hidden{ name = "step", value = "3" }
120 ui.title(_"Registration (step 3 of 3: Terms of use and password)")
121 ui.sectionHead( function()
122 ui.heading { level = 1, content = _"Read and accept the terms and choose a password" }
123 end )
124 ui.sectionRow( function()
125 ui.container{
126 attr = { class = "wiki use_terms" },
127 content = function()
128 slot.put(config.use_terms)
129 end
130 }
132 member.notify_email = notify_email or member.notify_email
133 member.name = name or member.name
134 member.login = login or member.login
136 execute.view{ module = "member", view = "_profile", params = {
137 member = member, include_private_data = true
138 } }
140 for i, checkbox in ipairs(config.use_terms_checkboxes) do
141 slot.put("<br />")
142 ui.tag{
143 tag = "div",
144 content = function()
145 ui.tag{
146 tag = "input",
147 attr = {
148 type = "checkbox",
149 id = "use_terms_checkbox_" .. checkbox.name,
150 name = "use_terms_checkbox_" .. checkbox.name,
151 value = "1",
152 style = "float: left;",
153 checked = param.get("use_terms_checkbox_" .. checkbox.name, atom.boolean) and "checked" or nil
154 }
155 }
156 slot.put(" ")
157 ui.tag{
158 tag = "label",
159 attr = { ['for'] = "use_terms_checkbox_" .. checkbox.name },
160 content = function() slot.put(checkbox.html) end
161 }
162 end
163 }
164 end
166 slot.put("<br />")
168 ui.tag{
169 tag = "p",
170 content = _"Please choose a password and enter it twice. The password is case sensitive."
171 }
172 ui.field.text{
173 readonly = true,
174 label = _'Login name',
175 name = 'login',
176 value = member.login
177 }
178 ui.field.password{
179 label = _'Password',
180 name = 'password1',
181 }
182 ui.field.password{
183 label = _'Password (repeat)',
184 name = 'password2',
185 }
186 ui.submit{
187 text = _'activate account'
188 }
189 slot.put(" ")
190 ui.link{
191 content = _"one step back",
192 module = "index",
193 view = "register",
194 params = {
195 code = code,
196 notify_email = notify_email,
197 name = name,
198 login = login,
199 step = 1
200 }
201 }
202 slot.put(" ")
203 ui.link{
204 content = _"cancel registration",
205 module = "index",
206 view = "index"
207 }
208 end )
209 end
210 end
211 end
212 }
