Re: Authenticate users with both username and email

2015-11-04 Thread Russell Keith-Magee
Yes, there *is* a very simple way to implement “Email address as username” - you use a custom user model that implements that approach. https://docs.djangoproject.com/en/1.8/topics/auth/customizing/#substituting-a-custom-user-model Django’s docs contain details of how to do this, and there are

Re: Authenticate users with both username and email

2015-11-04 Thread Patrick Breitenbach
Are you suggesting that there's a relatively easy way to implement "email address as username"? Is it as easy as just putting an email address into the username field? And making sure to update it when someone updates their email address? On Monday, January 19, 2015 at 2:33:35 AM UTC-8, James

Re: Authenticate users with both username and email

2015-01-19 Thread Abraham Varricatt
Damn. That's one heck of an explanation James! And very detailed to boot! As a programmer, the OP's approach to login a user with either username/email with ONLY the default auth system seemed flawed (or incomplete, at best) to me. You've not just validated my opinion, but given me a wonder

Re: Authenticate users with both username and email

2015-01-19 Thread James Schneider
I guess I'm not clear on what you are trying to achieve. There are a couple of scenarios to consider. As it stands with the default contrib.auth authentication backend, sending both the username and email address entered by the user will only work IF the user registered/was created using their

Re: Authenticate users with both username and email

2015-01-19 Thread Abraham Varricatt
Ignoring the malformed code, will the call to authenticate() even work without username? According to the docs, https://docs.djangoproject.com/en/1.7/topics/auth/default/#django.contrib.auth.authenticate It takes credentials in the form of keyword arguments, for the default > configuration this

Re: Authenticate users with both username and email

2015-01-15 Thread Matt Cooper
Your if block in views.py is not well-formed. I haven't tested this but I'd write it more like this: # try username user = auth.authenticate(username=username, password=password) if user is not None: auth.login(request, user) return HttpResponseRedirect('/') #

Authenticate users with both username and email

2015-01-15 Thread Kakar Nyori
I have extendted the *UserCreationForm* with email and other fields, so that I could authenticate a user with both its username and email. forms.py: > class UserCreationForm(UserCreationForm): > class Meta: > model = User > fields = ('first_name', 'last_name', 'username', 'email',)