liquid_feedback_frontend
annotate app/main/member/_action/update_password.lua @ 1849:c3dba3a85be3
Fixed translations
| author | bsw | 
|---|---|
| date | Thu Feb 03 16:10:39 2022 +0100 (2022-02-03) | 
| parents | 32cc544d5a5b | 
| children | 
| rev | line source | 
|---|---|
| bsw/jbe@1309 | 1 if app.session.member.role then | 
| bsw/jbe@1309 | 2 return execute.view { module = "index", view = "403" } | 
| bsw/jbe@1309 | 3 end | 
| bsw/jbe@1309 | 4 | 
| bsw@9 | 5 local old_password = param.get("old_password") | 
| bsw@9 | 6 local new_password1 = param.get("new_password1") | 
| bsw@9 | 7 local new_password2 = param.get("new_password2") | 
| bsw@9 | 8 | 
| bsw@9 | 9 if not Member:by_login_and_password(app.session.member.login, old_password) then | 
| bsw@9 | 10 slot.put_into("error", _"Old password is wrong") | 
| bsw@9 | 11 return false | 
| bsw@9 | 12 end | 
| bsw@9 | 13 | 
| bsw@9 | 14 if new_password1 ~= new_password2 then | 
| bsw@9 | 15 slot.put_into("error", _"New passwords does not match.") | 
| bsw@9 | 16 return false | 
| bsw@9 | 17 end | 
| bsw@9 | 18 | 
| bsw@9 | 19 if #new_password1 < 8 then | 
| bsw@9 | 20 slot.put_into("error", _"New passwords is too short.") | 
| bsw@9 | 21 return false | 
| bsw@9 | 22 end | 
| bsw@9 | 23 | 
| bsw@9 | 24 app.session.member:set_password(new_password1) | 
| bsw@9 | 25 app.session.member:save() | 
| bsw@9 | 26 | 
| bsw@9 | 27 slot.put_into("notice", _"Your password has been updated successfully") |