Hello there,

I have setup email login in a Django site in a very similar way as
http://djangosnippets.org/snippets/74/
It works on the admin, meaning a correct email/password combination logs
the user in.

The problem is when there is no user with the entered email address in
the database. The admin shows this misleading error message:   
"Usernames cannot contain the '@' character.".

To solve this, I have tried a custom AdminSite class (the error message
is displayed from the login view method in the AdminSite class) with a
modified login method, but then I have to find a way to get all the apps
registered in the default admin site (using a customized AdminSite
instance won't show any app in the admin index page).
I tried defining the get_urls method like this:

    def get_urls(self):
        from django.contrib.admin import site
        return site.get_urls()

but that doesn't work, because it uses django.contrib.site's login view
instead of mine, so I try hacking the urlpatterns:

    def get_urls(self):
        from django.contrib.admin import site
        index = self.admin_view(self.index)
        return patterns('', url(r'^$', index, name='index')) +
site.get_urls()[1:]

which does not work either, I get the "Looks like your browser isn't
configured to accept cookies. (...)" error message when logins should be
successful    :(

I don't want to keep on going with a custom admin site for only getting
that error message right, but I don't see any other way (don't want to
hack Django's code either, unless this is considered to be a bug).
Does anybody know of a better way to handle this?

Thanks!

-- 
Gonzalo Delgado <gonzalo...@gmail.com>

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

Reply via email to