Thanks for sharing!

Lio


On Thu, Jun 6, 2013 at 10:49 PM, Rob_McC <mrmccorm...@gmail.com> wrote:

> Lio:
>
> Not sure if this would be helpful, it was for my app. It seems to work so
> far.
>
> *This allows users to login with
> *
> - email
> OR
> - username
>
> I have a message reminding them they can login with either.
>
> I don't allow changing username, but allow changing email.
>
> I also will remove the Forgot your username, cause they can login with
> email.
>
> Good luck
> R
> File:
> *controllers/default.py*
>
>
> Reference:
>  http://www.web2pyslices.com/slice/show/1642/login-with-username-and-email
>
>
>
> def user():
>
>     if 'login' in request.args:
>         db.auth_user.username.label = T("Username or Email")
>         auth.settings.login_userfield = 'username'
>         if request.vars.username and not IS_EMAIL()(request.vars.username
> )[1]:
>             auth.settings.login_userfield = 'email'
>             request.vars.email = request.vars.username
>             request.post_vars.email = request.vars.email
>             request.vars.username = None
>             request.post_vars.username = None
>
>         return dict(form=auth())
>
>     return dict(form=auth())
>
>
>
>  --
>
> ---
> 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/r_2nobzCGyc/unsubscribe?hl=en.
> To unsubscribe from this group and all its topics, send an email to
> web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 

--- 
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/groups/opt_out.


Reply via email to