liquid_feedback_frontend

annotate app/main/index/register.lua @ 1233:ad207be24c7a

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

Impressum / About Us