Às 10:15 de 04/03/22, Maurice Waka escreveu:
We have this user function, and when a user requests for password retrieval.
I would like to have a flash message displayed once the link is sent to user email. So far the mail,successfully sends but how will the user know without the flash display message?
The code below doesn't seem to work.

def user():
    mail = auth.settings.mailer
    mail.settings.server = 'smtp.gmail.com:587'
    auth.messages.retrieve_username = 'Your user name: %(username)s'
    auth.messages.retrieve_username_subject = 'Username retrieval'
    auth.messages.reset_password_subject = 'Password Reset: '
    mail.settings.sender = 'my...@gmail.com'
    mail.settings.login = "my...@gmail.com:password"
    flash = dict(request_reset_password='Reset password email sent')
    auth.messages.email_sent = flash.get(request.args(0), auth.messages.email_sent)
    return dict(form=auth())
--
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 web2py+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/1145f937-2c73-4ca7-b798-a2589b562ff3n%40googlegroups.com <https://groups.google.com/d/msgid/web2py/1145f937-2c73-4ca7-b798-a2589b562ff3n%40googlegroups.com?utm_medium=email&utm_source=footer>.

Instead of:

flash = dict(request_reset_password='Reset password email sent')
auth.messages.email_sent = flash.get(request.args(0), auth.messages.email_sent)

use:

response.flash = 'Reset password email sent'


http://web2py.com/books/default/chapter/29/07/forms-and-validators#Forms-and-redirection

--
Com os melhores cumprimentos,

Carlos Correia
=========================
MEMÓRIA PERSISTENTE
GSM:  917 157 146 (Signal, WhatsApp)
e-mail:ge...@memoriapersistente.pt
URL:http://www.memoriapersistente.pt
XMPP (Jabber):car...@memoriapersistente.pt
GnuPG: wwwkeys.eu.pgp.net

--
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 web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/3d68866f-16eb-f093-ad32-18b47e4637e4%40memoriapersistente.pt.

Reply via email to