liquid_feedback_frontend

view app/main/registration_admin/_action/update_verification.lua @ 1346:19cdb6123514

Fixed creating account with verification images
author bsw
date Sun Aug 05 19:25:02 2018 +0200 (2018-08-05)
parents 32cc544d5a5b
children 07e320676bf3
line source
1 local verification = Verification:by_id(param.get_id())
3 local function update_data()
4 verification.verification_data = json.object()
6 for i, field in ipairs(config.self_registration.fields) do
7 local value = param.get(field.name)
8 if field.name == "fiscal_code" then
9 value = string.gsub(value, "[^A-Z0-9]", "")
10 elseif field.name == "mobile_phone" then
11 value = string.gsub(value, "[^0-9]", "")
12 elseif field.type ~= "image" then
13 value = string.gsub(value, "^%s+", "")
14 value = string.gsub(value, "%s+$", "")
15 value = string.gsub(value, "%s+", " ")
16 end
17 verification.verification_data[field.name] = value
18 end
19 end
21 if verification.verified_member_id then
23 local member = Member:by_id(verification.verified_member_id)
25 if param.get("cancel") then
26 db:query({ "SELECT delete_member(?)", member.id })
27 return
28 end
30 member.identification = param.get("identification")
31 member.notify_email = param.get("email")
32 member:save()
34 update_data()
36 verification:save()
38 if param.get("invite") then
39 member:send_invitation()
40 end
42 elseif param.get("drop") then
44 verification.denied = "now"
45 verification:save()
46 return
48 elseif param.get("accredit") then
50 local member = Member:by_id(verification.requesting_member_id)
51 member.identification = param.get("identification")
52 member.notify_email = param.get("email")
53 member:save()
54 member:send_invitation()
56 for i, unit_id in ipairs(config.self_registration.grant_privileges_for_unit_ids) do
57 local privilege = Privilege:new()
58 privilege.member_id = member.id
59 privilege.unit_id = unit_id
60 privilege.initiative_right = true
61 privilege.voting_right = true
62 privilege:save()
63 end
65 update_data()
67 verification.verified_member_id = verification.requesting_member_id
68 verification.verifying_member_id = app.session.member_id
69 verification.verified = "now"
71 verification:save()
74 else
76 update_data()
77 verification:save()
79 end

Impressum / About Us