liquid_feedback_frontend
diff app/main/index/_action/register.lua @ 79:26c8177ef348
Support for multiple usage terms accept checkboxes
(including neccessary bugfix in member model)
(including neccessary bugfix in member model)
| author | bsw |
|---|---|
| date | Thu Jul 15 18:27:47 2010 +0200 (2010-07-15) |
| parents | 8d91bccab0bf |
| children | 8d760110ee4a |
line diff
1.1 --- a/app/main/index/_action/register.lua Wed Jul 14 13:59:54 2010 +0200 1.2 +++ b/app/main/index/_action/register.lua Thu Jul 15 18:27:47 2010 +0200 1.3 @@ -126,9 +126,7 @@ 1.4 return false 1.5 end 1.6 1.7 -local use_terms_accepted = param.get("use_terms_accepted", atom.boolean) 1.8 - 1.9 -if login and use_terms_accepted == nil then 1.10 +if login and param.get("step") ~= "5" then 1.11 request.redirect{ 1.12 mode = "redirect", 1.13 module = "index", 1.14 @@ -143,21 +141,13 @@ 1.15 return false 1.16 end 1.17 1.18 -if use_terms_accepted ~= true then 1.19 - slot.put_into("error", _"You have to accept the terms of use to complete registration.") 1.20 - request.redirect{ 1.21 - mode = "redirect", 1.22 - module = "index", 1.23 - view = "register", 1.24 - params = { 1.25 - code = invite_code.code, 1.26 - notify_email = notify_email, 1.27 - name = name, 1.28 - login = login 1.29 - } 1.30 - } 1.31 - return false 1.32 -end 1.33 +for i, checkbox in ipairs(config.use_terms_checkboxes) do 1.34 + local accepted = param.get("use_terms_checkbox_" .. checkbox.name, atom.boolean) 1.35 + if not accepted then 1.36 + slot.put_into("error", checkbox.not_accepted_error) 1.37 + return false 1.38 + end 1.39 +end 1.40 1.41 local password1 = param.get("password1") 1.42 local password2 = param.get("password2") 1.43 @@ -174,38 +164,17 @@ 1.44 login = login 1.45 } 1.46 } 1.47 +--]] 1.48 return false 1.49 end 1.50 1.51 if password1 ~= password2 then 1.52 slot.put_into("error", _"Passwords don't match!") 1.53 - request.redirect{ 1.54 - mode = "redirect", 1.55 - module = "index", 1.56 - view = "register", 1.57 - params = { 1.58 - code = invite_code.code, 1.59 - notify_email = notify_email, 1.60 - name = name, 1.61 - login = login 1.62 - } 1.63 - } 1.64 return false 1.65 end 1.66 1.67 if #password1 < 8 then 1.68 slot.put_into("error", _"Passwords must consist of at least 8 characters!") 1.69 - request.redirect{ 1.70 - mode = "redirect", 1.71 - module = "index", 1.72 - view = "register", 1.73 - params = { 1.74 - code = invite_code.code, 1.75 - notify_email = notify_email, 1.76 - name = name, 1.77 - login = login 1.78 - } 1.79 - } 1.80 return false 1.81 end 1.82 1.83 @@ -217,23 +186,17 @@ 1.84 local success = member:set_notify_email(notify_email) 1.85 if not success then 1.86 slot.put_into("error", _"Can't send confirmation email") 1.87 - request.redirect{ 1.88 - mode = "redirect", 1.89 - module = "index", 1.90 - view = "register", 1.91 - params = { 1.92 - code = invite_code.code, 1.93 - notify_email = notify_email, 1.94 - name = name, 1.95 - login = login 1.96 - } 1.97 - } 1.98 return 1.99 end 1.100 1.101 member:set_password(password1) 1.102 member:save() 1.103 1.104 +for i, checkbox in ipairs(config.use_terms_checkboxes) do 1.105 + local accepted = param.get("use_terms_checkbox_" .. checkbox.name, atom.boolean) 1.106 + member:set_setting("use_terms_checkbox_" .. checkbox.name, "accepted") 1.107 +end 1.108 + 1.109 invite_code.member_id = member.id 1.110 invite_code.used = "now" 1.111 invite_code:save()