Thanks Anthony, it works perfectly. Another question. With: auth.settings.registration_requires_verification = True
An email will be sent for verification, but the flash message is not so clear "Email sent". Is there's a way to customize this flash message? Il giorno lunedì 27 aprile 2015 22:45:52 UTC+2, Anthony ha scritto: > > No, the one and only argument passed to the callback is the form (not the > user record), so it might be more clear if you change your lambda argument > name to "form" instead of "user". > > lambda form: ... form.vars.first_name ... > > Anthony > > On Monday, April 27, 2015 at 4:35:55 PM UTC-4, Gael Princivalle wrote: >> >> Thanks a lot Anthony. >> >> However I don't understand how using form.vars.field_name in >> auth.settings.register_onaccept. >> Can you give me an example? >> >> auth.settings.register_onaccept = lambda user: mail.send(to=' >> mye...@mydomain.com <javascript:>',subject='New user on mydomain.com', >> message='<html>First name of the new user: ' + form.vars.first_name + >> '</html>') >> >> This give me an error, global name form is not defined. >> >> >> Il giorno lunedì 27 aprile 2015 01:23:02 UTC+2, Anthony ha scritto: >>> >>> On Sunday, April 26, 2015 at 4:07:40 PM UTC-4, Gael Princivalle wrote: >>>> >>>> Hi all. >>>> >>>> I would like to customize emails that web2py send to the user for email >>>> verification and password change. >>>> For example now I have for email verification: >>>> Welcome mye...@mydomain.com! Click on the link http... to verify your >>>> email >>>> >>> >>> auth.messages.verify_email and auth.messages.verify_email_subject. The >>> former can contain string formatting keys with the names of any fields in >>> the registration form as well as "link" (e.g., "Welcome %(first_name)s >>> %(last_name)s. Click on the link %(link)s to verify your email."). >>> >>> >>>> Another thing, how is it possible to have the last registered user row >>>> in auth.settings.register_onaccept? >>>> I would like to send an email when a new user sign in. >>>> auth.settings.register_onaccept = lambda user: mail.send(to=' >>>> my_e...@my_domain.com',subject='New user on >>>> my_domain.com',message='<html>New >>>> user on my_domain.com<br/>' + user.first_name + '</html>') >>>> >>> >>> The form object is passed to register_onaccept, so you can access all >>> the values entered by the user via form.vars (i.e., form.vars.email, >>> form.vars.first_name, etc.). >>> >>> Anthony >>> >> -- 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. For more options, visit https://groups.google.com/d/optout.