Quick question about custom message for verification and password reset email sent

215 views
Skip to first unread message

Alex Bush

unread,
Jan 14, 2014, 7:28:14 AM1/14/14
to web...@googlegroups.com
Hi all,

I'm trying to set (custom) messages for both the verification email sent for new user registration and password reset email sent for existing users.

I have found the list of available messages here: http://www.web2py.com/book/default/chapter/09 however none of them seem to correspond to the messages I describe. I don't really want to start modifying the gluon files to include these messages so I wondered if anyone knows of an alternate method to setting these messages. I think it is important to let the user know they must verify their account by email and currently no notification is given to them.

Thanks!

Anthony

unread,
Jan 14, 2014, 8:46:48 AM1/14/14
to web...@googlegroups.com
On Tuesday, January 14, 2014 7:28:14 AM UTC-5, Alex Bush wrote:
Hi all,

I'm trying to set (custom) messages for both the verification email sent for new user registration

Do auth.messages.verify_email and auth.messages.verify_email_subject not work for you? Note, auth.messages.email_sent is for the flash message that tells the user an email was sent (it is a generic message, not specific to the verification email, though you could change it dynamically to a custom message when the register function is called).
 
and password reset email sent for existing users.

auth.messages.reset_password_subject and auth.messages.reset_password

Anthony

Alex Bush

unread,
Jan 14, 2014, 9:35:09 AM1/14/14
to web...@googlegroups.com
Appologies if the initial email was confusing and thank you for the reply Anthony, I understand and am using auth.messages.verify_email and auth.messages.verify_email_subject however I wondered if there was any way to set a specific flash message for each situation (verification email sent and password reset email sent) instead of the generic auth.messages.email_sent? 

At the moment the user is directed to the login page after registering and the only hint of a verification email is the email sent flash.

Anthony

unread,
Jan 14, 2014, 9:56:48 AM1/14/14
to web...@googlegroups.com
As I mentioned, you can change auth.messages.email_sent dynamically:

def user():
    flash
= dict(register='Verification email sent',
                 request_reset_password
='Reset password email sent')
    auth
.messages.email_sent = flash.get(request.args(0), auth.messages.email_sent)
   
return dict(form=auth())

Anthony

Alex Bush

unread,
Jan 14, 2014, 10:05:58 AM1/14/14
to web...@googlegroups.com
Thank you Anthony, that works beautifully!


--
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 a topic in the Google Groups "web2py-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/YL1CAdYavN8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to web2py+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply all
Reply to author
Forward
0 new messages