liquid_feedback_frontend

changeset 1490:63ce1a5c05c1

Small enhancements for self registration process and management
author bsw
date Wed Mar 27 12:40:33 2019 +0100 (2019-03-27)
parents 3ab878ba277e
children 4badb51649f7
files app/main/_filter_view/30_navigation.lua app/main/issue/_list.lua app/main/registration/_register_form.lua app/main/registration/register.lua app/main/registration_admin/_action/update_verification.lua app/main/registration_admin/index.lua app/main/registration_admin/verification.lua app/main/registration_admin/verification_accredited.lua locale/translations.de.lua
line diff
     1.1 --- a/app/main/_filter_view/30_navigation.lua	Mon Feb 18 19:46:36 2019 +0100
     1.2 +++ b/app/main/_filter_view/30_navigation.lua	Wed Mar 27 12:40:33 2019 +0100
     1.3 @@ -132,6 +132,11 @@
     1.4      ui.link{ content = _"Quick guide", module = "help", view = "introduction" }
     1.5    end }
     1.6    if app.session.member_id and app.session.member.admin then
     1.7 +    if config.self_registration then
     1.8 +      ui.tag{ tag = "li", content = function()
     1.9 +        ui.link{ content = _"User management", module = "registration_admin", view = "index" }
    1.10 +      end }
    1.11 +    end
    1.12      ui.tag{ tag = "li", content = function()
    1.13        if config.admin_link then
    1.14          ui.link(config.admin_link)
     2.1 --- a/app/main/issue/_list.lua	Mon Feb 18 19:46:36 2019 +0100
     2.2 +++ b/app/main/issue/_list.lua	Wed Mar 27 12:40:33 2019 +0100
     2.3 @@ -206,7 +206,9 @@
     2.4                  }
     2.5                end
     2.6                if not config.single_area_id then
     2.7 -                slot.put(" » ")
     2.8 +                if not config.single_unit_id then
     2.9 +                  slot.put(" » ")
    2.10 +                end
    2.11                  ui.link{
    2.12                    module = "index", view = "index", params = { unit = issue.area.unit_id, area = issue.area_id },
    2.13                    attr = { class = "area" }, content = issue.area.name
     3.1 --- a/app/main/registration/_register_form.lua	Mon Feb 18 19:46:36 2019 +0100
     3.2 +++ b/app/main/registration/_register_form.lua	Wed Mar 27 12:40:33 2019 +0100
     3.3 @@ -53,6 +53,23 @@
     3.4            { id = 12, name = "December" },
     3.5          }
     3.6        end
     3.7 +      if config.self_registration.lang == "de" then
     3.8 +        months = {
     3.9 +          { id = 0, name = _"month" },
    3.10 +          { id = 1, name = "Januar" },
    3.11 +          { id = 2, name = "Februar" },
    3.12 +          { id = 3, name = "März" },
    3.13 +          { id = 4, name = "April" },
    3.14 +          { id = 5, name = "Mai" },
    3.15 +          { id = 6, name = "Juni" },
    3.16 +          { id = 7, name = "Juli" },
    3.17 +          { id = 8, name = "August" },
    3.18 +          { id = 9, name = "September" },
    3.19 +          { id = 10, name = "Oktober" },
    3.20 +          { id = 11, name = "November" },
    3.21 +          { id = 12, name = "Dezember" },
    3.22 +        }
    3.23 +      end
    3.24        local years = { { id = 0, name = _"year" } }
    3.25        local min_age = config.self_registration.min_age or 16
    3.26        for i = (atom.date:get_current()).year - min_age, 1900, -1 do
     4.1 --- a/app/main/registration/register.lua	Mon Feb 18 19:46:36 2019 +0100
     4.2 +++ b/app/main/registration/register.lua	Wed Mar 27 12:40:33 2019 +0100
     4.3 @@ -15,7 +15,11 @@
     4.4        },
     4.5        content = function()
     4.6  
     4.7 -        ui.container{ content = config.self_registration.info_top }
     4.8 +        if config.self_registration.info_top_html then
     4.9 +          slot.put(config.self_registration.info_top_html)
    4.10 +        else
    4.11 +          ui.container{ content = config.self_registration.info_top }
    4.12 +        end 
    4.13          slot.put("<br />")
    4.14  
    4.15          execute.view{ module = "registration", view = "_register_form" }
    4.16 @@ -60,13 +64,17 @@
    4.17  
    4.18          slot.put("<br />")
    4.19  
    4.20 +        local text = _"Proceed with registration" 
    4.21 +        if config.self_registration.manual_invitation then
    4.22 +          text = _"Register now"
    4.23 +        end
    4.24          ui.tag{
    4.25            tag = "input",
    4.26            attr = {
    4.27              id = "register_button",
    4.28              type = "submit",
    4.29              class = "mdl-button mdl-js-button mdl-button--raised mdl-button--colored",
    4.30 -            value = _"Proceed with registration"
    4.31 +            value = text
    4.32            }
    4.33          }
    4.34          if config.self_registration.allow_bypass_checks then
     5.1 --- a/app/main/registration_admin/_action/update_verification.lua	Mon Feb 18 19:46:36 2019 +0100
     5.2 +++ b/app/main/registration_admin/_action/update_verification.lua	Wed Mar 27 12:40:33 2019 +0100
     5.3 @@ -83,7 +83,20 @@
     5.4    member.identification = param.get("identification")
     5.5    member.notify_email = param.get("email")
     5.6    member:save()
     5.7 -  member:send_invitation()
     5.8 +
     5.9 +  if config.self_registration.manual_invitation then
    5.10 +    local function secret_token()
    5.11 +      local parts = {}
    5.12 +      for i = 1, 5 do
    5.13 +        parts[#parts+1] = multirand.string(5, "23456789bcdfghjkmnpqrstvwxyz")
    5.14 +      end
    5.15 +      return (table.concat(parts, "-"))
    5.16 +    end
    5.17 +    member.invite_code = secret_token()
    5.18 +    member:save()
    5.19 +  else
    5.20 +    member:send_invitation()
    5.21 +  end
    5.22  
    5.23    for i, unit_id in ipairs(config.self_registration.grant_privileges_for_unit_ids) do
    5.24      local privilege = Privilege:new()
     6.1 --- a/app/main/registration_admin/index.lua	Mon Feb 18 19:46:36 2019 +0100
     6.2 +++ b/app/main/registration_admin/index.lua	Wed Mar 27 12:40:33 2019 +0100
     6.3 @@ -76,33 +76,40 @@
     6.4                end }
     6.5              end
     6.6  
     6.7 -            local count = Verification:new_selector()
     6.8 -              :add_where("verified_member_id ISNULL")
     6.9 -              :add_where("denied ISNULL")
    6.10 -              :add_where("comment ilike '%mobile phone number already used before'")
    6.11 -              :count()
    6.12 -            ui.tag{ tag = "li", content = function()
    6.13 -              ui.link{ module = "registration_admin", view = "verification_requests", params = { mode = "mobile_phone" }, content = _("Phone number used before (#{count})", { count = count }) }
    6.14 -            end }
    6.15 -            
    6.16 -            local count = Verification:new_selector()
    6.17 -              :add_where("verified_member_id ISNULL")
    6.18 -              :add_where("denied ISNULL")
    6.19 -              :add_where("comment ilike '%user with same name already exist'")
    6.20 -              :count()
    6.21 -            ui.tag{ tag = "li", content = function()
    6.22 -              ui.link{ module = "registration_admin", view = "verification_requests", params = { mode = "identification" }, content = _("Identification used before (#{count})", { count = count }) }
    6.23 -            end }
    6.24 -            
    6.25 -            
    6.26 -            local count = Verification:new_selector()
    6.27 -              :add_where("verified_member_id ISNULL")
    6.28 -              :add_where("denied ISNULL")
    6.29 -              :add_where("comment ilike '%user with same name already exists'")
    6.30 -              :count()
    6.31 -            ui.tag{ tag = "li", content = function()
    6.32 -              ui.link{ module = "registration_admin", view = "verification_requests", params = { mode = "same_name_already_exists" }, content = _("User with same name already exists (#{count})", { count = count }) }
    6.33 -            end }
    6.34 +            if 
    6.35 +              config.self_registration.check_for_italien_mobile_phone
    6.36 +              or config.self_registration.check_for_uk_mobile_phone
    6.37 +            then
    6.38 +              local count = Verification:new_selector()
    6.39 +                :add_where("verified_member_id ISNULL")
    6.40 +                :add_where("denied ISNULL")
    6.41 +                :add_where("comment ilike '%mobile phone number already used before'")
    6.42 +                :count()
    6.43 +              ui.tag{ tag = "li", content = function()
    6.44 +                ui.link{ module = "registration_admin", view = "verification_requests", params = { mode = "mobile_phone" }, content = _("Phone number used before (#{count})", { count = count }) }
    6.45 +              end }
    6.46 +            end
    6.47 +
    6.48 +            if not config.self_registration.manual_invitation then            
    6.49 +              local count = Verification:new_selector()
    6.50 +                :add_where("verified_member_id ISNULL")
    6.51 +                :add_where("denied ISNULL")
    6.52 +                :add_where("comment ilike '%user with same name already exist'")
    6.53 +                :count()
    6.54 +              ui.tag{ tag = "li", content = function()
    6.55 +                ui.link{ module = "registration_admin", view = "verification_requests", params = { mode = "identification" }, content = _("Identification used before (#{count})", { count = count }) }
    6.56 +              end }
    6.57 +              
    6.58 +              
    6.59 +              local count = Verification:new_selector()
    6.60 +                :add_where("verified_member_id ISNULL")
    6.61 +                :add_where("denied ISNULL")
    6.62 +                :add_where("comment ilike '%user with same name already exists'")
    6.63 +                :count()
    6.64 +              ui.tag{ tag = "li", content = function()
    6.65 +                ui.link{ module = "registration_admin", view = "verification_requests", params = { mode = "same_name_already_exists" }, content = _("User with same name already exists (#{count})", { count = count }) }
    6.66 +              end }
    6.67 +            end
    6.68              
    6.69              local count = Verification:new_selector()
    6.70                :add_where("verified_member_id ISNULL")
    6.71 @@ -166,48 +173,50 @@
    6.72            
    6.73          end }
    6.74  
    6.75 -        ui.container{ content = _"Role accounts" }
    6.76 -      
    6.77 -        ui.tag{ tag = "ul", content = function()
    6.78 +        if config.role_accounts then
    6.79 +
    6.80 +          ui.container{ content = _"Role accounts" }
    6.81 +        
    6.82 +          ui.tag{ tag = "ul", content = function()
    6.83  
    6.84 -          local count = RoleVerification:new_selector()
    6.85 -            :add_where("verified ISNULL")
    6.86 -            :add_where("denied ISNULL")
    6.87 -            :count()
    6.88 -          ui.tag{ tag = "li", content = function()
    6.89 -            ui.link{ module = "registration_admin", view = "role_verification_requests", content = _("Open requests (#{count})", { count = count }) }
    6.90 -          end }
    6.91 -          
    6.92 -          local count = RoleVerification:new_selector()
    6.93 -            :add_where("verified NOTNULL")
    6.94 -            :add_where("denied ISNULL")
    6.95 -            :join("member", nil, "member.id = role_verification.verified_member_id")
    6.96 -            :add_where("member.deleted ISNULL")
    6.97 -            :count()
    6.98 -          ui.tag{ tag = "li", content = function()
    6.99 -            ui.link{ module = "registration_admin", view = "role_verification_accredited", content = _("Accredited (#{count})", { count = count }) }
   6.100 +            local count = RoleVerification:new_selector()
   6.101 +              :add_where("verified ISNULL")
   6.102 +              :add_where("denied ISNULL")
   6.103 +              :count()
   6.104 +            ui.tag{ tag = "li", content = function()
   6.105 +              ui.link{ module = "registration_admin", view = "role_verification_requests", content = _("Open requests (#{count})", { count = count }) }
   6.106 +            end }
   6.107 +            
   6.108 +            local count = RoleVerification:new_selector()
   6.109 +              :add_where("verified NOTNULL")
   6.110 +              :add_where("denied ISNULL")
   6.111 +              :join("member", nil, "member.id = role_verification.verified_member_id")
   6.112 +              :add_where("member.deleted ISNULL")
   6.113 +              :count()
   6.114 +            ui.tag{ tag = "li", content = function()
   6.115 +              ui.link{ module = "registration_admin", view = "role_verification_accredited", content = _("Accredited (#{count})", { count = count }) }
   6.116 +            end }
   6.117 +            
   6.118 +            local count = RoleVerification:new_selector()
   6.119 +              :add_where("verified NOTNULL")
   6.120 +              :add_where("denied ISNULL")
   6.121 +              :join("member", nil, "member.id = role_verification.verified_member_id")
   6.122 +              :add_where("member.deleted NOTNULL")
   6.123 +              :count()
   6.124 +            ui.tag{ tag = "li", content = function()
   6.125 +              ui.link{ module = "registration_admin", view = "role_verification_cancelled", content = _("Cancelled (#{count})", { count = count }) }
   6.126 +            end }
   6.127 +            
   6.128 +            local count = RoleVerification:new_selector()
   6.129 +              :add_where("verified ISNULL")
   6.130 +              :add_where("denied NOTNULL")
   6.131 +              :count()
   6.132 +            ui.tag{ tag = "li", content = function()
   6.133 +              ui.link{ module = "registration_admin", view = "role_verification_rejected", content = _("Rejected (#{count})", { count = count }) }
   6.134 +            end }
   6.135 +            
   6.136            end }
   6.137 -          
   6.138 -          local count = RoleVerification:new_selector()
   6.139 -            :add_where("verified NOTNULL")
   6.140 -            :add_where("denied ISNULL")
   6.141 -            :join("member", nil, "member.id = role_verification.verified_member_id")
   6.142 -            :add_where("member.deleted NOTNULL")
   6.143 -            :count()
   6.144 -          ui.tag{ tag = "li", content = function()
   6.145 -            ui.link{ module = "registration_admin", view = "role_verification_cancelled", content = _("Cancelled (#{count})", { count = count }) }
   6.146 -          end }
   6.147 -          
   6.148 -          local count = RoleVerification:new_selector()
   6.149 -            :add_where("verified ISNULL")
   6.150 -            :add_where("denied NOTNULL")
   6.151 -            :count()
   6.152 -          ui.tag{ tag = "li", content = function()
   6.153 -            ui.link{ module = "registration_admin", view = "role_verification_rejected", content = _("Rejected (#{count})", { count = count }) }
   6.154 -          end }
   6.155 -          
   6.156 -          
   6.157 -        end }
   6.158 +        end          
   6.159  
   6.160        end }
   6.161      end }
     7.1 --- a/app/main/registration_admin/verification.lua	Mon Feb 18 19:46:36 2019 +0100
     7.2 +++ b/app/main/registration_admin/verification.lua	Wed Mar 27 12:40:33 2019 +0100
     7.3 @@ -49,7 +49,7 @@
     7.4  
     7.5        ui.form{
     7.6          module = "registration_admin", action = "update_verification", id = verification.id,
     7.7 -        routing = { ok = { mode = "redirect", module = "registration_admin", view = "index" } },
     7.8 +        routing = { ok = { mode = "redirect", module = "registration_admin", view = "verification", id = verification.id } },
     7.9          record = data,
    7.10          content = function()
    7.11  
    7.12 @@ -118,7 +118,11 @@
    7.13                name = "identification",
    7.14                value = identification
    7.15              }
    7.16 -            
    7.17 +
    7.18 +            if member and not member.activated and member.invite_code then
    7.19 +              ui.container{ content = "Invite-Code: " .. member.invite_code }
    7.20 +            end
    7.21 +
    7.22            end }
    7.23              
    7.24            ui.container{ attr = { class = "mdl-card__actions mdl-card--border" }, content = function()
    7.25 @@ -128,7 +132,7 @@
    7.26              elseif verification.verified_member_id then
    7.27                ui.submit{ attr = { class = "mdl-button mdl-js-button mdl-button--raised" }, value = "Save personal data" }
    7.28                slot.put(" &nbsp; ")
    7.29 -              if not member.activated then
    7.30 +              if not member.activated and not config.self_registration.manual_invitation then
    7.31                  ui.submit{ name = "invite", attr = { class = "mdl-button mdl-js-button mdl-button--raised" }, value = "Send email invitation again" }
    7.32                  slot.put(" &nbsp; ")
    7.33                end
     8.1 --- a/app/main/registration_admin/verification_accredited.lua	Mon Feb 18 19:46:36 2019 +0100
     8.2 +++ b/app/main/registration_admin/verification_accredited.lua	Wed Mar 27 12:40:33 2019 +0100
     8.3 @@ -41,7 +41,7 @@
     8.4                      ui.container{ content = function()
     8.5                        local member = Member:by_id(record.verified_member_id)
     8.6                        if member then
     8.7 -                        ui.link{ module = "registration_admin", view = "verification", id = record.id, content = member.identification }  
     8.8 +                        ui.link{ module = "registration_admin", view = "verification", id = record.id, content = member.identification or "[no ident]" }  
     8.9                        end
    8.10                      end }
    8.11                    end
     9.1 --- a/locale/translations.de.lua	Mon Feb 18 19:46:36 2019 +0100
     9.2 +++ b/locale/translations.de.lua	Wed Mar 27 12:40:33 2019 +0100
     9.3 @@ -1012,4 +1012,20 @@
     9.4  ["expert editor (HTML)"] = "Expertenmodus (HTML)";
     9.5  ["show profile"] = "Profil aufrufen";
     9.6  ["show ballot"] = "Stimmzettel aufrufen";
     9.7 +["year"] = "Jahr";
     9.8 +["month"] = "Monat";
     9.9 +["Self registration"] = "Selbstregistrierung";
    9.10 +["Proceed with registration"] = "Registrierung fortsetzen";
    9.11 +["Register now"] = "Jetzt registrieren";
    9.12 +["User management"] = "Benutzerverwaltung";
    9.13 +["User accounts"] = "Benutzerkonten";
    9.14 +["Open requests (#{count})"] = "Offene Anfragen (#{count})";
    9.15 +["Manual verification requested during step 1 (#{count})"] = "Manuelle Verifikation in Schritt 1 angefragt (#{count})";
    9.16 +["other reasons (#{count})"] = "Andere Gründe (#{count})";
    9.17 +["Accredited (#{count})"] = "Akkreditiert (#{count})";
    9.18 +["Account not activated (yet) (#{count})"] = "Konto (noch) nicht aktiviert (#{count})";
    9.19 +["Activated accounts (#{count})"] = "Aktivierte Konten (#{count})";
    9.20 +["Cancelled accounts (#{count})"] = "Gesperrte Konten (#{count})";
    9.21 +["Rejected requests (#{count})"] = "Abgelehnte Anfragen (#{count})";
    9.22 +
    9.23  }

Impressum / About Us