Friday, October 30, 2009

Re: best approach for using email as username

Hi

Firstly you can try using  the following auth-backend
http://www.djangosnippets.org/snippets/74/

secondly
while rendering the signup form to the user
you can write a clean method in your signnup form like
   
def clean_email(self):
        try:
            user=User.objects.get(email__exact=self.cleaned_data["email"])
            raise forms.ValidationError(u"A user already is subscribed to this email, please choose another email ID")
        except User.DoesNotExist:
            # email is unique


        return self.cleaned_data["email"]


On Fri, Oct 30, 2009 at 7:24 PM, wancharle sebastiao quirino <wancharle@gmail.com> wrote:
Hi,

The unique problem is username = email.

You could create auth backend for login with email but email != username

I use:
 http://code.google.com/p/django-profile/

In django-profile login is with username and email is opcional...
But i add email auth backend and user can login with your email if registred.



ps.: i dont speak english....

2009/10/29 Adrián Ribao <aribao@gmail.com>


Hello,

I need to use the email field as the username. I neet these:

* Email must be unique
* I should authenticate against the email
* The admin should work I I should be able to create users with
username = email address.

I have a custom authentication method but I need more. I need to tell
Django to make the email unique, and I need to login and create users
from the admin with the @ character.

What is the best approach for this?

I've been searching in google but no one of the solutions can
accomplish the three points I need.

Thank you!

Adrian.







--
Regards
Subramanyam

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate