[web2py] Re: auth.change_password() - no flash message

2013-10-13 Thread Massimo Di Pierro
Mind if you have a double redirect before redirection, you can tell web2py to carry on any flash message: session.flash = response.flash Perhaps this should be done automatically by the redirect function. On Sunday, 13 October 2013 09:12:42 UTC-5, lesssugar wrote: > > Thank you, Massimo, i

[web2py] Re: auth.change_password() - no flash message

2013-10-13 Thread lesssugar
Thank you, Massimo, it's all clear now. On Sunday, October 13, 2013 4:10:50 PM UTC+2, Massimo Di Pierro wrote: > > The redirecting page sets session.flash. After redirection this gets > copied into response.flash and displayed by the default layout, unless > somewhere in the logic there is somet

[web2py] Re: auth.change_password() - no flash message

2013-10-13 Thread Massimo Di Pierro
The redirecting page sets session.flash. After redirection this gets copied into response.flash and displayed by the default layout, unless somewhere in the logic there is something that sets session.flash=None before redirection or response.flash=None after redirection. Double redirection may

[web2py] Re: auth.change_password() - no flash message

2013-10-13 Thread lesssugar
Anthony, it worked. I was staring at this code and didn't see it. Thanks a lot. On Sunday, October 13, 2013 3:44:39 PM UTC+2, Anthony wrote: > > > change_password = auth.change_password(next=URL('profile', 'settings')) >> > > When the password change form is submitted, the above sets session.flas

[web2py] Re: auth.change_password() - no flash message

2013-10-13 Thread Anthony
> change_password = auth.change_password(next=URL('profile', 'settings')) > When the password change form is submitted, the above sets session.flash to "Password changed." and then redirects back to this same function. When the redirect request comes in, the Auth code moves session.flash into

[web2py] Re: auth.change_password() - no flash message

2013-10-13 Thread lesssugar
You're right. When I changed the page to redirect after password change - the "Password changed" flash shows up. I don't quite understand what do you mean by overriding response.flash. Does it mean you assume that the previous redirect-page had a flash displayed onload? On Sunday, October 13,

[web2py] Re: auth.change_password() - no flash message

2013-10-13 Thread Massimo Di Pierro
If you look into gluon/tools.py there is this line: session.flash = self.messages.password_changed So there is a flash after password changed. perhaps you redirect to a page that overrides response.flash? On Saturday, 12 October 2013 16:23:44 UTC-5, lesssugar wrote: > > I'm using auth.change_p

[web2py] Re: auth.change_password() - no flash message

2013-10-13 Thread lesssugar
I have two forms in the Settings page: change password and change email. My code in profile.py: @auth.requires_login() def settings(): #change user's password change_password = auth.change_password(next=URL('profile', 'settings')) change_password.update(_class='formstyle', _name='change_

[web2py] Re: auth.change_password() - no flash message

2013-10-12 Thread Anthony
Is there any code in the settings function or view that could be clearing the session flash or somehow removing/overriding the flash? auth.change_password sets session.flash before the redirect, so session flash should get moved into response.flash after the redirect. Anthony On Saturday, Octo

[web2py] Re: auth.change_password() - no flash message

2013-10-12 Thread lesssugar
OK, I removed next from auth.change_password(). Now, after submitting, I'm being redirected to default/index and the default flash message appears. The thing is I would like to stay on Settings page after changing the password - hence I tried next. Is there a way to change the default redirect

[web2py] Re: auth.change_password() - no flash message

2013-10-12 Thread Anthony
auth.change_password() does a redirect when you specify "next", so you can't set anything after calling it. However, instead you can just do: auth.messages.password_changed = 'Your custom flash message' Of course, there is already a default message set ("Password changed."), so if you're not se