liquid_feedback_frontend
diff app/main/index/_action/update_password.lua @ 0:3bfb2fcf7ab9
Version alpha1
author | bsw/jbe |
---|---|
date | Wed Nov 18 12:00:00 2009 +0100 (2009-11-18) |
parents | |
children |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/app/main/index/_action/update_password.lua Wed Nov 18 12:00:00 2009 +0100 1.3 @@ -0,0 +1,23 @@ 1.4 +local old_password = param.get("old_password") 1.5 +local new_password1 = param.get("new_password1") 1.6 +local new_password2 = param.get("new_password2") 1.7 + 1.8 +if not Member:by_login_and_password(app.session.member.login, old_password) then 1.9 + slot.put_into("error", _"Old password is wrong") 1.10 + return false 1.11 +end 1.12 + 1.13 +if new_password1 ~= new_password2 then 1.14 + slot.put_into("error", _"New passwords does not match.") 1.15 + return false 1.16 +end 1.17 + 1.18 +if #new_password1 < 8 then 1.19 + slot.put_into("error", _"New passwords is too short.") 1.20 + return false 1.21 +end 1.22 + 1.23 +app.session.member:set_password(new_password1) 1.24 +app.session.member:save() 1.25 + 1.26 +slot.put_into("notice", _"Your password has been updated successfully")