Actually, the funny thing is that the user record from the db is in fact
passed to the email_reset_password() function, so in theory one could
include the username in the message, but as you noted, the only items that
can be interpolated into the message are the key and the link. Here's a
workaround:
def set_reset_message(form):
user = db.auth_user(email=form.vars.email)
username = user.username if user else ''
auth.messages.reset_password = 'Hey %s, click on the link %%(link)s to
reset your password' % username
auth.settings.reset_password_onvalidation = set_reset_message
That will change the message right after the reset form is submitted and
validated, but before the email is sent.
Anthony
On Wednesday, June 5, 2013 9:57:20 AM UTC-4, Niphlod wrote:
>
> uhm. the user requesting the password is not logged-in. that message is
> passed on to the email_reset_password() function, that interpolates that
> message with just dict(key=reset_password_key, link=link)
>
> Now, the issue is that there's no way for the message to calculate any
> username cause it's not given ANY reference to the user's row.
>
--
---
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.