liquid_feedback_frontend
annotate app/main/registration/_action/register_pin.lua @ 1731:899fdfb23465
Modified workflow of automatic verification
author | bsw |
---|---|
date | Thu Sep 30 10:04:31 2021 +0200 (2021-09-30) |
parents | 32cc544d5a5b |
children |
rev | line source |
---|---|
bsw/jbe@1309 | 1 local id = param.get_id() |
bsw/jbe@1309 | 2 local verification = Verification:by_id(id) |
bsw/jbe@1309 | 3 |
bsw/jbe@1309 | 4 if not verification then |
bsw/jbe@1309 | 5 return false |
bsw/jbe@1309 | 6 end |
bsw/jbe@1309 | 7 |
bsw/jbe@1309 | 8 local pin = param.get("pin") |
bsw/jbe@1309 | 9 |
bsw/jbe@1309 | 10 if param.get("manual_verification") then |
bsw/jbe@1309 | 11 verification.comment = (verification.comment or "") .. " /// User requested manual verification (during step 2)" |
bsw/jbe@1309 | 12 verification:save() |
bsw/jbe@1309 | 13 request.redirect{ external = encode.url { module = "registration", view = "register_manual_check_needed" } } |
bsw/jbe@1309 | 14 return false |
bsw/jbe@1309 | 15 elseif verification.request_data.sms_code ~= pin then |
bsw/jbe@1309 | 16 verification.request_data.sms_code_tries = verification.request_data.sms_code_tries - 1 |
bsw/jbe@1309 | 17 verification.comment = (verification.comment or "") .. " /// User entered wrong PIN " .. pin |
bsw/jbe@1309 | 18 if verification.request_data.sms_code_tries > 0 then |
bsw/jbe@1309 | 19 verification:save() |
bsw/jbe@1309 | 20 request.redirect{ external = encode.url { module = "registration", view = "register_enter_pin", id = verification.id, params = { invalid_pin = true } } } |
bsw/jbe@1309 | 21 return false |
bsw/jbe@1309 | 22 else |
bsw/jbe@1309 | 23 verification.comment = (verification.comment or "") .. " /// Manual verification needed: user entered invalid PIN three times" |
bsw/jbe@1309 | 24 verification:save() |
bsw/jbe@1309 | 25 request.redirect{ external = encode.url { module = "registration", view = "register_manual_check_needed" } } |
bsw/jbe@1309 | 26 return false |
bsw/jbe@1309 | 27 end |
bsw/jbe@1309 | 28 end |
bsw/jbe@1309 | 29 |
bsw/jbe@1309 | 30 verification.comment = (verification.comment or "").. " /// User entered correct PIN code" |
bsw/jbe@1309 | 31 |
bsw@1731 | 32 local success = execute.action{ |
bsw@1731 | 33 module = "registration", action = "_verify", params = { |
bsw@1731 | 34 verification = verification |
bsw@1731 | 35 } |
bsw@1731 | 36 } |
bsw@1731 | 37 if success == "ok" then |
bsw@1731 | 38 request.redirect{ external = encode.url { module = "registration", view = "register_completed" } } |
bsw/jbe@1309 | 39 end |
bsw/jbe@1309 | 40 |