liquid_feedback_frontend

annotate app/main/member/_action/update_login.lua @ 859:b3a7b8cdd403

Translation and help messages in Simplified Chinese, directly converted from Traditional Chinese (zh-TW)
author Chun-Ting Hsu
date Fri Aug 17 17:39:11 2012 +0200 (2012-08-17)
parents c587d8762e62
children 58f48a8a202a
rev   line source
bsw@286 1 if config.locked_profile_fields.login then
bsw@286 2 error("access denied")
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