[PATCH v2] auth: let users log in using their email address

Mads Kiilerich mads at kiilerich.com
Sat May 16 19:50:56 EDT 2015


On 05/16/2015 03:49 PM, Andrew Shadura wrote:
> # HG changeset patch
> # User Andrew Shadura <andrew at shadura.me>
> # Date 1431709586 -7200
> #      Fri May 15 19:06:26 2015 +0200
> # Node ID 93de511e84fe940786acf468789a77daed83a461
> # Parent  95bffe63997d40bfab5ae6b8d1a54859d6275471
> auth: let users log in using their email address
>
> diff --git a/kallithea/controllers/login.py b/kallithea/controllers/login.py
> --- a/kallithea/controllers/login.py
> +++ b/kallithea/controllers/login.py
> @@ -121,9 +121,15 @@ class LoginController(BaseController):
>                   session.invalidate()
>                   c.form_result = login_form.to_python(dict(request.POST))
>                   # form checks for username/password, now we're authenticated
> +
> +                username = c.form_result['username']
> +                if '@' in username:
> +                    username = User.get_by_email(username).username

This will still fail if the username not is a valid email address?

/Mads




More information about the kallithea-general mailing list