liquid_feedback_frontend
diff app/main/registration/_action/_verify.lua @ 1843:b01d9920371b
merge
| author | jbe |
|---|---|
| date | Thu Feb 03 15:57:22 2022 +0100 (2022-02-03) |
| parents | e39206c7c4ea |
| children |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/app/main/registration/_action/_verify.lua Thu Feb 03 15:57:22 2022 +0100 1.3 @@ -0,0 +1,38 @@ 1.4 +local verification = param.get("verification", "table") 1.5 + 1.6 +local identification = config.self_registration.identification_func(verification.request_data) 1.7 + 1.8 +local members_with_same_identification = Member:new_selector() 1.9 + :add_where{ "identification = ?", identification } 1.10 + :exec() 1.11 + 1.12 +if #members_with_same_identification > 0 then 1.13 + verification.comment = (verification.comment or "").. " /// Manual verification needed: user with same name already exists" 1.14 + verification:save() 1.15 + request.redirect{ external = encode.url { module = "registration", view = "register_manual_check_needed" } } 1.16 + return false 1.17 +end 1.18 + 1.19 +local member = Member:by_id(verification.requesting_member_id) 1.20 + 1.21 +member.identification = identification 1.22 +member.notify_email = verification.request_data.email 1.23 + 1.24 +member:send_invitation() 1.25 + 1.26 +for i, unit_id in ipairs(config.self_registration.grant_privileges_for_unit_ids) do 1.27 + local privilege = Privilege:new() 1.28 + privilege.member_id = member.id 1.29 + privilege.unit_id = unit_id 1.30 + privilege.initiative_right = true 1.31 + privilege.voting_right = true 1.32 + privilege:save() 1.33 +end 1.34 + 1.35 +verification.verified = "now" 1.36 +verification.verification_data = verification.request_data 1.37 +verification.verified_member_id = member.id 1.38 +verification.comment = (verification.comment or "").. " /// Account created" 1.39 + 1.40 +verification:save() 1.41 +