bsw@9: local name = param.get("name") bsw@9: bsw@9: name = util.trim(name) bsw@9: bsw@9: if #name < 3 then bsw@9: slot.put_into(_error, _"This name is too short!") bsw@9: end bsw@9: bsw@9: bsw@9: app.session.member.name = name bsw@9: bsw@9: local db_error = app.session.member:try_save() bsw@9: bsw@9: if db_error then bsw@9: if db_error:is_kind_of("IntegrityConstraintViolation.UniqueViolation") then bsw@9: slot.put_into("error", _"This name is already taken, please choose another one!") bsw@9: return false bsw@9: end bsw@9: db_error:escalate() bsw@9: end bsw@9: bsw@9: slot.put_into("notice", _"Your name has been changed")