liquid_feedback_frontend

view app/main/index/register.lua @ 741:6e4392a4ed9b

Fixed hidden actions in registration process
author bsw
date Thu Jun 28 22:24:54 2012 +0200 (2012-06-28)
parents 4a106804aafb
children b8b205e65c6d
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 = "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.title(_"Registration (step 1 of 3: Invite code)")
23 ui.field.hidden{ name = "step", value = 1 }
24 ui.tag{
25 tag = "p",
26 content = _"Please enter the invite code you've received."
27 }
28 ui.field.text{
29 label = _'Invite code',
30 name = 'code',
31 value = param.get("invite")
32 }
34 else
35 local member = Member:new_selector()
36 :add_where{ "invite_code = ?", code }
37 :add_where{ "activated ISNULL" }
38 :optional_object_mode()
39 :for_update()
40 :exec()
42 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
43 ui.title(_"Registration (step 2 of 3: Personal information)")
44 ui.field.hidden{ name = "step", value = 2 }
45 ui.actions(function()
46 ui.link{
47 content = function()
48 ui.image{ static = "icons/16/resultset_previous.png" }
49 slot.put(_"One step back")
50 end,
51 module = "index",
52 view = "register",
53 params = {
54 }
55 }
56 end)
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, include_private_data = 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 else
100 ui.field.hidden{ name = "step", value = "3" }
101 ui.title(_"Registration (step 3 of 3: Terms of use and password)")
102 ui.actions(function()
103 ui.link{
104 content = function()
105 ui.image{ static = "icons/16/resultset_previous.png" }
106 slot.put(_"One step back")
107 end,
108 module = "index",
109 view = "register",
110 params = {
111 code = code,
112 notify_email = notify_email,
113 name = name,
114 login = login,
115 step = 1
116 }
117 }
118 end)
119 ui.container{
120 attr = { class = "wiki use_terms" },
121 content = function()
122 if config.use_terms_html then
123 slot.put(config.use_terms_html)
124 else
125 slot.put(format.wiki_text(config.use_terms))
126 end
127 end
128 }
130 member.notify_email = notify_email or member.notify_email
131 member.name = name or member.name
132 member.login = login or member.login
134 execute.view{ module = "member", view = "_profile", params = {
135 member = member, include_private_data = true
136 } }
138 for i, checkbox in ipairs(config.use_terms_checkboxes) do
139 slot.put("<br />")
140 ui.tag{
141 tag = "div",
142 content = function()
143 ui.tag{
144 tag = "input",
145 attr = {
146 type = "checkbox",
147 id = "use_terms_checkbox_" .. checkbox.name,
148 name = "use_terms_checkbox_" .. checkbox.name,
149 value = "1",
150 style = "float: left;",
151 checked = param.get("use_terms_checkbox_" .. checkbox.name, atom.boolean) and "checked" or nil
152 }
153 }
154 slot.put("&nbsp;")
155 ui.tag{
156 tag = "label",
157 attr = { ['for'] = "use_terms_checkbox_" .. checkbox.name },
158 content = function() slot.put(checkbox.html) end
159 }
160 end
161 }
162 end
164 slot.put("<br />")
166 ui.tag{
167 tag = "p",
168 content = _"Please choose a password and enter it twice. The password is case sensitive."
169 }
170 ui.field.password{
171 label = _'Password',
172 name = 'password1',
173 }
174 ui.field.password{
175 label = _'Password (repeat)',
176 name = 'password2',
177 }
179 end
180 end
182 ui.submit{
183 text = _'Create account'
184 }
186 ui.actions(function()
187 ui.link{
188 content = function()
189 ui.image{ static = "icons/16/cancel.png" }
190 slot.put(_"Cancel registration")
191 end,
192 module = "index",
193 view = "index"
194 }
195 end)
196 end
197 }

Impressum / About Us