bsw@1733: local verification = param.get("verification", "table") bsw@1733: bsw@1733: local identification = config.self_registration.identification_func(verification.request_data) bsw@1733: bsw@1733: local members_with_same_identification = Member:new_selector() bsw@1733: :add_where{ "identification = ?", identification } bsw@1733: :exec() bsw@1733: bsw@1733: if #members_with_same_identification > 0 then bsw@1733: verification.comment = (verification.comment or "").. " /// Manual verification needed: user with same name already exists" bsw@1733: verification:save() bsw@1733: request.redirect{ external = encode.url { module = "registration", view = "register_manual_check_needed" } } bsw@1733: return false bsw@1733: end bsw@1733: bsw@1733: local member = Member:by_id(verification.requesting_member_id) bsw@1733: bsw@1733: member.identification = identification bsw@1733: member.notify_email = verification.request_data.email bsw@1733: bsw@1733: member:send_invitation() bsw@1733: bsw@1733: for i, unit_id in ipairs(config.self_registration.grant_privileges_for_unit_ids) do bsw@1733: local privilege = Privilege:new() bsw@1733: privilege.member_id = member.id bsw@1733: privilege.unit_id = unit_id bsw@1733: privilege.initiative_right = true bsw@1733: privilege.voting_right = true bsw@1733: privilege:save() bsw@1733: end bsw@1733: bsw@1739: verification.verified = "now" bsw@1739: verification.verification_data = verification.request_data bsw@1733: verification.verified_member_id = member.id bsw@1733: verification.comment = (verification.comment or "").. " /// Account created" bsw@1733: bsw@1733: verification:save() bsw@1733: