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

Andrew Shadura andrew at shadura.me
Sat May 16 20:11:02 EDT 2015


Hello,

On Sun, 17 May 2015 01:50:56 +0200
Mads Kiilerich <mads at kiilerich.com> wrote:

> > 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?

No, as this code will never be executed (input rejected by a validator
first).

Correct me if I'm wrong, but if I read the code correctly, the check
here will have no effect (which is why I haven't added it).

-- 
Cheers,
  Andrew
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: OpenPGP digital signature
URL: <http://lists.sfconservancy.org/pipermail/kallithea-general/attachments/20150517/1e5e9263/attachment.sig>


More information about the kallithea-general mailing list