ក្រុម រូបភាព ការបន្ទាន់សម័យ នានា វ៉ែប ថតឯកសារ
Recently Visited Groups | Help | Sign in
Google Groups Home
Using email as username for django auth
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  3 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
zweb  
View profile  
 More options Jul 5 2009, 7:09 am
From: zweb <traderash...@gmail.com>
Date: Sat, 4 Jul 2009 17:09:23 -0700 (PDT)
Local: Sun, Jul 5 2009 7:09 am
Subject: Using email as username for django auth
i just increased the size of username in auth_user table to 100 and I
enter email as user name from my register user web page.

 Django auth is working fine. I use my own form and view but django's
authenticate and login methods.

It did not give me any errors saying I cannot enter or use (at) sign.

Am I missing something? Why are people writing alternate auth backends
for this?


    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
djangou53r@gmail.com  
View profile  
 More options Jul 5 2009, 8:32 am
From: "djangou...@gmail.com" <djangou...@gmail.com>
Date: Sat, 4 Jul 2009 18:32:43 -0700
Local: Sun, Jul 5 2009 8:32 am
Subject: Re: Using email as username for django auth

Mind sharing your modifications?

-- Sent from my Palm Pre

zweb wrote:

i just increased the size of username in auth_user table to 100 and I
enter email as user name from my register user web page.

 Django auth is working fine. I use my own form and view but django's
authenticate and login methods.

It did not give me any errors saying I cannot enter or use (at) sign.

Am I missing something? Why are people writing alternate auth backends
for this?


    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Michael  
View profile  
 More options Jul 5 2009, 11:45 pm
From: Michael <newmani...@gmail.com>
Date: Sun, 5 Jul 2009 12:45:26 -0400
Local: Sun, Jul 5 2009 11:45 pm
Subject: Re: Using email as username for django auth

On Sat, Jul 4, 2009 at 8:09 PM, zweb <traderash...@gmail.com> wrote:

> i just increased the size of username in auth_user table to 100 and I
> enter email as user name from my register user web page.

Just for the record this is unsupported in Django (due to the constaints
django.contrib.auth.models.User.username), and I will guarantee this
behavior will break in the future  when model validation hits (currently a
GSOC project).

The reason e-mail isn't used as a username is due to, I assume, the way it
was initially created. There are a lot of sites that would prefer to have a
username instead of an e-mail available to the users. So a decision was made
a long time ago and released for us to use. And for me, and a lot of other
people who use Django, and even for your use case with the e-mail
authentication, it works well.

That said the custom auth backend and reading from a field named e-mail
directly, as I showed in the links, is really simple and the code is already
written for you. The only tricky part is creating a username, which you can
do by parsing the email address and placing it in the username field. Simple
really, only you need to know that is what is happening.

My recommendation is to extend the auth module a touch by adding less than
40 LOC to your code base. You could also rewrite the auth module if you
would like. I would not recommend relying on the undocumented behavior.

Michael


    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2010 Google