liquid_feedback_frontend

annotate app/main/member/_action/update_login.lua @ 1539:52185c8f5746

Fixed access to non-existing session object
author bsw
date Tue Oct 20 17:51:38 2020 +0200 (2020-10-20)
parents 32cc544d5a5b
children
rev   line source
bsw/jbe@1309 1 if util.is_profile_field_locked(app.session.member, "login") or app.session.member.role then
bsw/jbe@1309 2 return execute.view { module = "index", view = "403" }
bsw@286 3 end
bsw@286 4
bsw@9 5 local login = param.get("login")
bsw@9 6
bsw@9 7 login = util.trim(login)
bsw@9 8
bsw@9 9 if #login < 3 then
bsw@9 10 slot.put_into(_error, _"This login is too short!")
bsw@9 11 end
bsw@9 12
bsw@9 13 app.session.member.login = login
bsw@9 14
bsw@9 15 local db_error = app.session.member:try_save()
bsw@9 16
bsw@9 17 if db_error then
bsw@9 18 if db_error:is_kind_of("IntegrityConstraintViolation.UniqueViolation") then
bsw@9 19 slot.put_into("error", _"This login is already taken, please choose another one!")
bsw@9 20 return false
bsw@9 21 end
bsw@9 22 db_error:escalate()
bsw@9 23 end
bsw@9 24
bsw@9 25 slot.put_into("notice", _("Your login has been changed to '#{login}'", { login = login }))

Impressum / About Us