liquid_feedback_frontend

annotate app/main/index/register.lua @ 963:03b0ac783fe0

Removed unnecessary lock
author bsw
date Thu Feb 21 18:56:59 2013 +0100 (2013-02-21)
parents ff4ee93abdb8
children 701a5cf6b067
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(_"Cancel registration")
bsw@742 27 end,
bsw@742 28 module = "index",
bsw@742 29 view = "index"
bsw@742 30 }
bsw@742 31 end)
bsw@286 32 ui.field.hidden{ name = "step", value = 1 }
bsw/jbe@5 33 ui.tag{
bsw/jbe@5 34 tag = "p",
bsw/jbe@5 35 content = _"Please enter the invite code you've received."
bsw/jbe@5 36 }
bsw/jbe@5 37 ui.field.text{
bsw@286 38 label = _'Invite code',
bsw@286 39 name = 'code',
bsw/jbe@6 40 value = param.get("invite")
bsw/jbe@6 41 }
bsw@747 42 ui.submit{
bsw@747 43 text = _'Proceed with registration'
bsw@747 44 }
bsw/jbe@6 45
bsw/jbe@5 46 else
bsw@286 47 local member = Member:new_selector()
bsw@286 48 :add_where{ "invite_code = ?", code }
bsw@286 49 :add_where{ "activated ISNULL" }
bsw@286 50 :optional_object_mode()
bsw@286 51 :exec()
bsw@286 52
bsw@286 53 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 54 ui.title(_"Registration (step 2 of 3: Personal information)")
bsw@286 55 ui.field.hidden{ name = "step", value = 2 }
bsw@741 56 ui.actions(function()
bsw@286 57 ui.link{
bsw@286 58 content = function()
bsw@745 59 slot.put(_"One step back")
bsw@745 60 end,
bsw@745 61 module = "index",
bsw@745 62 view = "register",
bsw@745 63 params = {
bsw@750 64 invite = code
bsw@745 65 }
bsw@745 66 }
bsw@745 67 slot.put(" · ")
bsw@745 68 ui.link{
bsw@745 69 content = function()
bsw@742 70 slot.put(_"Cancel registration")
bsw@742 71 end,
bsw@742 72 module = "index",
bsw@742 73 view = "index"
bsw@742 74 }
bsw@286 75 end)
bsw@286 76
bsw@286 77 ui.tag{
bsw@286 78 tag = "p",
bsw@286 79 content = _"This invite key is connected with the following information:"
bsw/jbe@6 80 }
bsw@286 81
bsw@286 82 execute.view{ module = "member", view = "_profile", params = { member = member, include_private_data = true } }
bsw@79 83
bsw@286 84 if not config.locked_profile_fields.notify_email then
bsw@286 85 ui.tag{
bsw@286 86 tag = "p",
bsw@286 87 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 88 }
bsw@286 89 ui.field.text{
bsw@286 90 label = _'Email address',
bsw@286 91 name = 'notify_email',
bsw@286 92 value = param.get("notify_email") or member.notify_email
bsw@286 93 }
bsw@286 94 end
bsw@286 95 if not config.locked_profile_fields.name then
bsw@286 96 ui.tag{
bsw@286 97 tag = "p",
bsw@286 98 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 99 }
bsw@286 100 ui.field.text{
bsw@286 101 label = _'Screen name',
bsw@286 102 name = 'name',
bsw@286 103 value = param.get("name") or member.name
bsw@286 104 }
bsw@286 105 end
bsw@286 106 if not config.locked_profile_fields.login then
bsw@286 107 ui.tag{
bsw@286 108 tag = "p",
bsw@286 109 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 110 }
bsw@286 111 ui.field.text{
bsw@286 112 label = _'Login name',
bsw@286 113 name = 'login',
bsw@286 114 value = param.get("login") or member.login
bsw@286 115 }
bsw@286 116 end
bsw@747 117 ui.submit{
bsw@747 118 text = _'Proceed with registration'
bsw@747 119 }
bsw@286 120 else
bsw@286 121
bsw@286 122 ui.field.hidden{ name = "step", value = "3" }
bsw@740 123 ui.title(_"Registration (step 3 of 3: Terms of use and password)")
bsw@741 124 ui.actions(function()
bsw@286 125 ui.link{
bsw@286 126 content = function()
bsw@286 127 slot.put(_"One step back")
bsw@286 128 end,
bsw@286 129 module = "index",
bsw@286 130 view = "register",
bsw@286 131 params = {
bsw@286 132 code = code,
bsw@286 133 notify_email = notify_email,
bsw@286 134 name = name,
bsw@286 135 login = login,
bsw@286 136 step = 1
bsw@286 137 }
bsw@286 138 }
bsw@743 139 slot.put(" · ")
bsw@742 140 ui.link{
bsw@742 141 content = function()
bsw@742 142 slot.put(_"Cancel registration")
bsw@742 143 end,
bsw@742 144 module = "index",
bsw@742 145 view = "index"
bsw@742 146 }
bsw@286 147 end)
bsw@286 148 ui.container{
bsw@286 149 attr = { class = "wiki use_terms" },
bsw@79 150 content = function()
bsw@286 151 if config.use_terms_html then
bsw@286 152 slot.put(config.use_terms_html)
bsw@286 153 else
bsw@286 154 slot.put(format.wiki_text(config.use_terms))
bsw@286 155 end
bsw@79 156 end
bsw@79 157 }
bsw@79 158
bsw@739 159 member.notify_email = notify_email or member.notify_email
bsw@739 160 member.name = name or member.name
bsw@739 161 member.login = login or member.login
bsw@739 162
bsw@739 163 execute.view{ module = "member", view = "_profile", params = {
bsw@739 164 member = member, include_private_data = true
bsw@739 165 } }
bsw@739 166
bsw@286 167 for i, checkbox in ipairs(config.use_terms_checkboxes) do
bsw@286 168 slot.put("<br />")
bsw@286 169 ui.tag{
bsw@286 170 tag = "div",
bsw@286 171 content = function()
bsw@286 172 ui.tag{
bsw@286 173 tag = "input",
bsw@286 174 attr = {
bsw@286 175 type = "checkbox",
bsw@398 176 id = "use_terms_checkbox_" .. checkbox.name,
bsw@286 177 name = "use_terms_checkbox_" .. checkbox.name,
bsw@286 178 value = "1",
bsw@286 179 style = "float: left;",
bsw@286 180 checked = param.get("use_terms_checkbox_" .. checkbox.name, atom.boolean) and "checked" or nil
bsw@286 181 }
bsw@286 182 }
bsw@286 183 slot.put("&nbsp;")
bsw@398 184 ui.tag{
bsw@398 185 tag = "label",
bsw@398 186 attr = { ['for'] = "use_terms_checkbox_" .. checkbox.name },
bsw@398 187 content = function() slot.put(checkbox.html) end
bsw@398 188 }
bsw@286 189 end
bsw@286 190 }
bsw@286 191 end
bsw@79 192
bsw@286 193 slot.put("<br />")
bsw/jbe@6 194
bsw@286 195 ui.tag{
bsw@286 196 tag = "p",
bsw@286 197 content = _"Please choose a password and enter it twice. The password is case sensitive."
bsw@286 198 }
bsw@746 199 ui.field.text{
bsw@746 200 readonly = true,
bsw@746 201 label = _'Login name',
bsw@746 202 name = 'login',
bsw@746 203 value = member.login
bsw@746 204 }
bsw@286 205 ui.field.password{
bsw@286 206 label = _'Password',
bsw@286 207 name = 'password1',
bsw@286 208 }
bsw@286 209 ui.field.password{
bsw@286 210 label = _'Password (repeat)',
bsw@286 211 name = 'password2',
bsw@286 212 }
bsw@747 213 ui.submit{
bsw@747 214 text = _'Activate account'
bsw@747 215 }
bsw@286 216 end
bsw/jbe@5 217 end
bsw/jbe@5 218 end
bsw/jbe@5 219 }
bsw/jbe@5 220
bsw/jbe@5 221

Impressum / About Us