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, October 12, 2013 6:00:00 PM UTC-4, lesssugar wrote:
>
> 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 URL with my own?
>
> On Saturday, October 12, 2013 11:46:58 PM UTC+2, Anthony wrote:
>>
>> 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 seeing it, something is going wrong. Do you get other
>> flash messages? Maybe confirm that session.flash is being set.
>>
>> Anthony
>>
>> On Saturday, October 12, 2013 5:23:44 PM UTC-4, lesssugar wrote:
>>>
>>> I'm using auth.change_password() in my profile Settings section. The
>>> code responsible for the form:
>>>
>>> change_password = auth.change_password(next=URL('profile', 'settings'))
>>> change_password.update(_class='formstyle', _name='change_password')
>>>
>>> return dict(change_password=change_password)
>>>
>>>
>>> The form works, the input is processed, the password gets changed.
>>> However there's no flash message after submitting the form. I guess, as
>>> change_password() is a build-in function, there should be a default flash
>>> message.
>>>
>>> I tried adding this (below), and it also doesn't work:
>>>
>>> if change_password.accepted:
>>> response.flash = "Password changed"
>>>
>>> Any ideas?
>>>
>>>
>>>
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.