liquid_feedback_frontend
annotate app/main/member/_action/update_name.lua @ 500:03c205fc17f0
Show blue quorum bar in bargraph more clear, fixed too big quorum in ie
| author | bsw |
|---|---|
| date | Wed Mar 21 19:43:44 2012 +0100 (2012-03-21) |
| parents | c587d8762e62 |
| children | 58f48a8a202a |
| rev | line source |
|---|---|
| bsw@286 | 1 if config.locked_profile_fields.name then |
| bsw@286 | 2 error("access denied") |
| bsw@286 | 3 end |
| bsw@286 | 4 |
| bsw@9 | 5 local name = param.get("name") |
| bsw@9 | 6 |
| bsw@9 | 7 name = util.trim(name) |
| bsw@9 | 8 |
| bsw@75 | 9 if #name < 3 then |
| bsw@75 | 10 slot.put_into("error", _"This name is too short!") |
| bsw@75 | 11 return false |
| bsw@9 | 12 end |
| bsw@9 | 13 |
| bsw@9 | 14 app.session.member.name = name |
| bsw@9 | 15 |
| bsw@9 | 16 local db_error = app.session.member:try_save() |
| bsw@9 | 17 |
| bsw@9 | 18 if db_error then |
| bsw@9 | 19 if db_error:is_kind_of("IntegrityConstraintViolation.UniqueViolation") then |
| bsw@9 | 20 slot.put_into("error", _"This name is already taken, please choose another one!") |
| bsw@9 | 21 return false |
| bsw@9 | 22 end |
| bsw@9 | 23 db_error:escalate() |
| bsw@9 | 24 end |
| bsw@9 | 25 |
| bsw@9 | 26 slot.put_into("notice", _"Your name has been changed") |