Hi Jay Martin. Actually, I ended up coding my own functions instead of
instantiating the Auth class. That is, I coded my own login, register,
reset_password, etc functions.
For example, for the login, this is the code in the controller:
# This code should run when the users posts the form with all required
data, and after doing some validation to the data provided
from gluon.tools import web2py_uuid
registration_key = web2py_uuid()
db.auth_user.insert(\
first_name=form.vars.first_name, \
last_name=form.vars.last_name, \
email=form.vars.email, \
password=db.auth_user.password.validate(form.vars.password)[0], \
registration_key=registration_key)
mail.send(to=form.vars.email, subject='Confirm your registration', \
message='Hi %s, thanks for registering in our website!\n\n' %first_name +
\
'To finish the registration, please click on the next link:\n' + \
'%s\n\n' %URL('default', 'user/verify_email/%s' %registration_key, host=
request.env.http_host))
Then, in the default/user/verify_email I use this code:
registration_key = request.args(1)
user = db(db.auth_user.registration_key==registration_key).select().first()
if not user:
redirect(URL('default', 'index'))
user.update_record(registration_key='')
auth.login_user(user)
session.flash = 'Your registration has been confirmed. Thanks!'
redirect(URL('init', 'default', 'index'))
I hope it helps!
El sábado, 22 de noviembre de 2014 10:39:12 UTC-3, Jay Martin escribió:
>
> @Lisandro, would happen to have these code snippets handy to share? I'm
> interested in using the mailgun api too. Either way, thanks for checking!
>
> My best,
> Jay
>
> On Tuesday, October 29, 2013 5:46:51 PM UTC-4, Lisandro wrote:
>>
>> ...
>>
>> For those interested in doing that, is just as simple as instantiating
>> Auth class and overwriting wanted methods, for example, I overwrited
>> "register" and "email_reset_password" methods in Auth class, that is, to
>> send my custom emails on register and request reset password respectively.
>>
>> Regards, Lisandro.
>>
>>
>>
--
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/d/optout.