liquid_feedback_frontend

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

Impressum / About Us