# HG changeset patch
# User bsw
# Date 1553686833 -3600
# Node ID 63ce1a5c05c1bfc2169888fe1a3150f27d8f91af
# Parent 3ab878ba277e688bb6d98346764e3c855dc27468
Small enhancements for self registration process and management
diff -r 3ab878ba277e -r 63ce1a5c05c1 app/main/_filter_view/30_navigation.lua
--- a/app/main/_filter_view/30_navigation.lua Mon Feb 18 19:46:36 2019 +0100
+++ b/app/main/_filter_view/30_navigation.lua Wed Mar 27 12:40:33 2019 +0100
@@ -132,6 +132,11 @@
ui.link{ content = _"Quick guide", module = "help", view = "introduction" }
end }
if app.session.member_id and app.session.member.admin then
+ if config.self_registration then
+ ui.tag{ tag = "li", content = function()
+ ui.link{ content = _"User management", module = "registration_admin", view = "index" }
+ end }
+ end
ui.tag{ tag = "li", content = function()
if config.admin_link then
ui.link(config.admin_link)
diff -r 3ab878ba277e -r 63ce1a5c05c1 app/main/issue/_list.lua
--- a/app/main/issue/_list.lua Mon Feb 18 19:46:36 2019 +0100
+++ b/app/main/issue/_list.lua Wed Mar 27 12:40:33 2019 +0100
@@ -206,7 +206,9 @@
}
end
if not config.single_area_id then
- slot.put(" » ")
+ if not config.single_unit_id then
+ slot.put(" » ")
+ end
ui.link{
module = "index", view = "index", params = { unit = issue.area.unit_id, area = issue.area_id },
attr = { class = "area" }, content = issue.area.name
diff -r 3ab878ba277e -r 63ce1a5c05c1 app/main/registration/_register_form.lua
--- a/app/main/registration/_register_form.lua Mon Feb 18 19:46:36 2019 +0100
+++ b/app/main/registration/_register_form.lua Wed Mar 27 12:40:33 2019 +0100
@@ -53,6 +53,23 @@
{ id = 12, name = "December" },
}
end
+ if config.self_registration.lang == "de" then
+ months = {
+ { id = 0, name = _"month" },
+ { id = 1, name = "Januar" },
+ { id = 2, name = "Februar" },
+ { id = 3, name = "März" },
+ { id = 4, name = "April" },
+ { id = 5, name = "Mai" },
+ { id = 6, name = "Juni" },
+ { id = 7, name = "Juli" },
+ { id = 8, name = "August" },
+ { id = 9, name = "September" },
+ { id = 10, name = "Oktober" },
+ { id = 11, name = "November" },
+ { id = 12, name = "Dezember" },
+ }
+ end
local years = { { id = 0, name = _"year" } }
local min_age = config.self_registration.min_age or 16
for i = (atom.date:get_current()).year - min_age, 1900, -1 do
diff -r 3ab878ba277e -r 63ce1a5c05c1 app/main/registration/register.lua
--- a/app/main/registration/register.lua Mon Feb 18 19:46:36 2019 +0100
+++ b/app/main/registration/register.lua Wed Mar 27 12:40:33 2019 +0100
@@ -15,7 +15,11 @@
},
content = function()
- ui.container{ content = config.self_registration.info_top }
+ if config.self_registration.info_top_html then
+ slot.put(config.self_registration.info_top_html)
+ else
+ ui.container{ content = config.self_registration.info_top }
+ end
slot.put("
")
execute.view{ module = "registration", view = "_register_form" }
@@ -60,13 +64,17 @@
slot.put("
")
+ local text = _"Proceed with registration"
+ if config.self_registration.manual_invitation then
+ text = _"Register now"
+ end
ui.tag{
tag = "input",
attr = {
id = "register_button",
type = "submit",
class = "mdl-button mdl-js-button mdl-button--raised mdl-button--colored",
- value = _"Proceed with registration"
+ value = text
}
}
if config.self_registration.allow_bypass_checks then
diff -r 3ab878ba277e -r 63ce1a5c05c1 app/main/registration_admin/_action/update_verification.lua
--- a/app/main/registration_admin/_action/update_verification.lua Mon Feb 18 19:46:36 2019 +0100
+++ b/app/main/registration_admin/_action/update_verification.lua Wed Mar 27 12:40:33 2019 +0100
@@ -83,7 +83,20 @@
member.identification = param.get("identification")
member.notify_email = param.get("email")
member:save()
- member:send_invitation()
+
+ if config.self_registration.manual_invitation then
+ local function secret_token()
+ local parts = {}
+ for i = 1, 5 do
+ parts[#parts+1] = multirand.string(5, "23456789bcdfghjkmnpqrstvwxyz")
+ end
+ return (table.concat(parts, "-"))
+ end
+ member.invite_code = secret_token()
+ member:save()
+ else
+ member:send_invitation()
+ end
for i, unit_id in ipairs(config.self_registration.grant_privileges_for_unit_ids) do
local privilege = Privilege:new()
diff -r 3ab878ba277e -r 63ce1a5c05c1 app/main/registration_admin/index.lua
--- a/app/main/registration_admin/index.lua Mon Feb 18 19:46:36 2019 +0100
+++ b/app/main/registration_admin/index.lua Wed Mar 27 12:40:33 2019 +0100
@@ -76,33 +76,40 @@
end }
end
- local count = Verification:new_selector()
- :add_where("verified_member_id ISNULL")
- :add_where("denied ISNULL")
- :add_where("comment ilike '%mobile phone number already used before'")
- :count()
- ui.tag{ tag = "li", content = function()
- ui.link{ module = "registration_admin", view = "verification_requests", params = { mode = "mobile_phone" }, content = _("Phone number used before (#{count})", { count = count }) }
- end }
-
- local count = Verification:new_selector()
- :add_where("verified_member_id ISNULL")
- :add_where("denied ISNULL")
- :add_where("comment ilike '%user with same name already exist'")
- :count()
- ui.tag{ tag = "li", content = function()
- ui.link{ module = "registration_admin", view = "verification_requests", params = { mode = "identification" }, content = _("Identification used before (#{count})", { count = count }) }
- end }
-
-
- local count = Verification:new_selector()
- :add_where("verified_member_id ISNULL")
- :add_where("denied ISNULL")
- :add_where("comment ilike '%user with same name already exists'")
- :count()
- ui.tag{ tag = "li", content = function()
- ui.link{ module = "registration_admin", view = "verification_requests", params = { mode = "same_name_already_exists" }, content = _("User with same name already exists (#{count})", { count = count }) }
- end }
+ if
+ config.self_registration.check_for_italien_mobile_phone
+ or config.self_registration.check_for_uk_mobile_phone
+ then
+ local count = Verification:new_selector()
+ :add_where("verified_member_id ISNULL")
+ :add_where("denied ISNULL")
+ :add_where("comment ilike '%mobile phone number already used before'")
+ :count()
+ ui.tag{ tag = "li", content = function()
+ ui.link{ module = "registration_admin", view = "verification_requests", params = { mode = "mobile_phone" }, content = _("Phone number used before (#{count})", { count = count }) }
+ end }
+ end
+
+ if not config.self_registration.manual_invitation then
+ local count = Verification:new_selector()
+ :add_where("verified_member_id ISNULL")
+ :add_where("denied ISNULL")
+ :add_where("comment ilike '%user with same name already exist'")
+ :count()
+ ui.tag{ tag = "li", content = function()
+ ui.link{ module = "registration_admin", view = "verification_requests", params = { mode = "identification" }, content = _("Identification used before (#{count})", { count = count }) }
+ end }
+
+
+ local count = Verification:new_selector()
+ :add_where("verified_member_id ISNULL")
+ :add_where("denied ISNULL")
+ :add_where("comment ilike '%user with same name already exists'")
+ :count()
+ ui.tag{ tag = "li", content = function()
+ ui.link{ module = "registration_admin", view = "verification_requests", params = { mode = "same_name_already_exists" }, content = _("User with same name already exists (#{count})", { count = count }) }
+ end }
+ end
local count = Verification:new_selector()
:add_where("verified_member_id ISNULL")
@@ -166,48 +173,50 @@
end }
- ui.container{ content = _"Role accounts" }
-
- ui.tag{ tag = "ul", content = function()
+ if config.role_accounts then
+
+ ui.container{ content = _"Role accounts" }
+
+ ui.tag{ tag = "ul", content = function()
- local count = RoleVerification:new_selector()
- :add_where("verified ISNULL")
- :add_where("denied ISNULL")
- :count()
- ui.tag{ tag = "li", content = function()
- ui.link{ module = "registration_admin", view = "role_verification_requests", content = _("Open requests (#{count})", { count = count }) }
- end }
-
- local count = RoleVerification:new_selector()
- :add_where("verified NOTNULL")
- :add_where("denied ISNULL")
- :join("member", nil, "member.id = role_verification.verified_member_id")
- :add_where("member.deleted ISNULL")
- :count()
- ui.tag{ tag = "li", content = function()
- ui.link{ module = "registration_admin", view = "role_verification_accredited", content = _("Accredited (#{count})", { count = count }) }
+ local count = RoleVerification:new_selector()
+ :add_where("verified ISNULL")
+ :add_where("denied ISNULL")
+ :count()
+ ui.tag{ tag = "li", content = function()
+ ui.link{ module = "registration_admin", view = "role_verification_requests", content = _("Open requests (#{count})", { count = count }) }
+ end }
+
+ local count = RoleVerification:new_selector()
+ :add_where("verified NOTNULL")
+ :add_where("denied ISNULL")
+ :join("member", nil, "member.id = role_verification.verified_member_id")
+ :add_where("member.deleted ISNULL")
+ :count()
+ ui.tag{ tag = "li", content = function()
+ ui.link{ module = "registration_admin", view = "role_verification_accredited", content = _("Accredited (#{count})", { count = count }) }
+ end }
+
+ local count = RoleVerification:new_selector()
+ :add_where("verified NOTNULL")
+ :add_where("denied ISNULL")
+ :join("member", nil, "member.id = role_verification.verified_member_id")
+ :add_where("member.deleted NOTNULL")
+ :count()
+ ui.tag{ tag = "li", content = function()
+ ui.link{ module = "registration_admin", view = "role_verification_cancelled", content = _("Cancelled (#{count})", { count = count }) }
+ end }
+
+ local count = RoleVerification:new_selector()
+ :add_where("verified ISNULL")
+ :add_where("denied NOTNULL")
+ :count()
+ ui.tag{ tag = "li", content = function()
+ ui.link{ module = "registration_admin", view = "role_verification_rejected", content = _("Rejected (#{count})", { count = count }) }
+ end }
+
end }
-
- local count = RoleVerification:new_selector()
- :add_where("verified NOTNULL")
- :add_where("denied ISNULL")
- :join("member", nil, "member.id = role_verification.verified_member_id")
- :add_where("member.deleted NOTNULL")
- :count()
- ui.tag{ tag = "li", content = function()
- ui.link{ module = "registration_admin", view = "role_verification_cancelled", content = _("Cancelled (#{count})", { count = count }) }
- end }
-
- local count = RoleVerification:new_selector()
- :add_where("verified ISNULL")
- :add_where("denied NOTNULL")
- :count()
- ui.tag{ tag = "li", content = function()
- ui.link{ module = "registration_admin", view = "role_verification_rejected", content = _("Rejected (#{count})", { count = count }) }
- end }
-
-
- end }
+ end
end }
end }
diff -r 3ab878ba277e -r 63ce1a5c05c1 app/main/registration_admin/verification.lua
--- a/app/main/registration_admin/verification.lua Mon Feb 18 19:46:36 2019 +0100
+++ b/app/main/registration_admin/verification.lua Wed Mar 27 12:40:33 2019 +0100
@@ -49,7 +49,7 @@
ui.form{
module = "registration_admin", action = "update_verification", id = verification.id,
- routing = { ok = { mode = "redirect", module = "registration_admin", view = "index" } },
+ routing = { ok = { mode = "redirect", module = "registration_admin", view = "verification", id = verification.id } },
record = data,
content = function()
@@ -118,7 +118,11 @@
name = "identification",
value = identification
}
-
+
+ if member and not member.activated and member.invite_code then
+ ui.container{ content = "Invite-Code: " .. member.invite_code }
+ end
+
end }
ui.container{ attr = { class = "mdl-card__actions mdl-card--border" }, content = function()
@@ -128,7 +132,7 @@
elseif verification.verified_member_id then
ui.submit{ attr = { class = "mdl-button mdl-js-button mdl-button--raised" }, value = "Save personal data" }
slot.put(" ")
- if not member.activated then
+ if not member.activated and not config.self_registration.manual_invitation then
ui.submit{ name = "invite", attr = { class = "mdl-button mdl-js-button mdl-button--raised" }, value = "Send email invitation again" }
slot.put(" ")
end
diff -r 3ab878ba277e -r 63ce1a5c05c1 app/main/registration_admin/verification_accredited.lua
--- a/app/main/registration_admin/verification_accredited.lua Mon Feb 18 19:46:36 2019 +0100
+++ b/app/main/registration_admin/verification_accredited.lua Wed Mar 27 12:40:33 2019 +0100
@@ -41,7 +41,7 @@
ui.container{ content = function()
local member = Member:by_id(record.verified_member_id)
if member then
- ui.link{ module = "registration_admin", view = "verification", id = record.id, content = member.identification }
+ ui.link{ module = "registration_admin", view = "verification", id = record.id, content = member.identification or "[no ident]" }
end
end }
end
diff -r 3ab878ba277e -r 63ce1a5c05c1 locale/translations.de.lua
--- a/locale/translations.de.lua Mon Feb 18 19:46:36 2019 +0100
+++ b/locale/translations.de.lua Wed Mar 27 12:40:33 2019 +0100
@@ -1012,4 +1012,20 @@
["expert editor (HTML)"] = "Expertenmodus (HTML)";
["show profile"] = "Profil aufrufen";
["show ballot"] = "Stimmzettel aufrufen";
+["year"] = "Jahr";
+["month"] = "Monat";
+["Self registration"] = "Selbstregistrierung";
+["Proceed with registration"] = "Registrierung fortsetzen";
+["Register now"] = "Jetzt registrieren";
+["User management"] = "Benutzerverwaltung";
+["User accounts"] = "Benutzerkonten";
+["Open requests (#{count})"] = "Offene Anfragen (#{count})";
+["Manual verification requested during step 1 (#{count})"] = "Manuelle Verifikation in Schritt 1 angefragt (#{count})";
+["other reasons (#{count})"] = "Andere Gründe (#{count})";
+["Accredited (#{count})"] = "Akkreditiert (#{count})";
+["Account not activated (yet) (#{count})"] = "Konto (noch) nicht aktiviert (#{count})";
+["Activated accounts (#{count})"] = "Aktivierte Konten (#{count})";
+["Cancelled accounts (#{count})"] = "Gesperrte Konten (#{count})";
+["Rejected requests (#{count})"] = "Abgelehnte Anfragen (#{count})";
+
}