Okay, I modified my code as follows:
#####################
# Controller: ACCOUNT
#####################
def changePassword():
change_password = auth.change_password()
if change_password.accepts(request.vars, session,
onvalidation=validateChangePassword):
response.flash = "Password updated"
return change_password
def validateChangePassword(form):
"""
"""
old_pass = form.vars.old_password
new_pass = form.vars.new_password
new_pass2 = form.vars.new_password2
if not new_pass or new_pass.strip() == '':
form.errors.new_password = 'Can not be empty'
return False
if not new_pass2 or new_pass2.strip() == '':
form.errors.new_password2 = 'Can not be empty'
return False
return True
####################
# End of Controller
####################
Now validation works as desired and response.flash says "Password
Updated" when validation is passed. Only that the database doesn't get
updated and password doesn't really get updated. I am lost.
On Feb 26, 2:37 am, Carlos <[email protected]> wrote:
> Isn't the redirect automatically happening via
> auth.settings.change_password_next?,
> if this is the case, I believe you would need session.flash.
>
> Why are you using javascript's "document.location=..." instead of web2py's
> redirect?.
>
> The session.flash might be lost because of these javascript redirection.
On Feb 26, 2:37 am, Carlos <[email protected]> wrote:
> Isn't the redirect automatically happening via
> auth.settings.change_password_next?,
> if this is the case, I believe you would need session.flash.
>
> Why are you using javascript's "document.location=..." instead of web2py's
> redirect?.
>
> The session.flash might be lost because of these javascript redirection.