Multiple issues in Email authentication implementation

Issue #1342 resolved
Former user created an issue

While working on a satchmo installation I stumbled into something I consider a bug. While you do seem to provide logic for the so called email authentication, the implementation doesn't seem to work: in fact trying to use an email address > 30 chars to login results in an error.

I tried to isolate the problem and it seems to reside in EmailAuthenticationForm (satchmo_store.accounts.forms.py). Since I personally don't get why you are using the solution implemented in that class so I got rid of it and replaced with:

class EmailAuthenticationForm(AuthenticationForm): username = forms.CharField(label=_("Username"), max_length=75)

Using this class in satchmo_store.accounts.forms.py fixes the issue, but since patching a satchmo installation doesn't seem the smartest idea I stored that class in a custom forms.py in the project tree and I added a line in urls.py to use satchmo_store.accounts.views.emaillogin passing auth_form='MyOwnEmailAuthenticationForm' to it. However I ended up hitting a further bug in satchmo: emaillogin calls (line 38) _login but it doesn't pass auth_form so _login ends up using satchmo's own EmailAuthenticationForm so, again, trying to authenticate with an email address longer than 30 chars results in an error.

So, unless I am missing something, summing it up: there seems to be two bugs:

  1. satchmo_store.accounts.forms.EmailAuthenticationForm simply doesn't work.

  2. while both satchmo_store.accounts.views.emaillogin and ._login theorically support passing a custom auth_form, the way _login gets called by emaillogin actually hardcode satchmo_store.accounts.forms.EmailAuthenticationForm in the latter.

Comments (3)

  1. Log in to comment