Saturday, April 2, 2011

Re: How to create django custom login page?

For the sake of clarity and future reference, let me suggest another approach that will suffice for some use cases.

Sometimes your need can be solved simply by extending upon the original login page, without rewriting anything. For example, if you would like to take e-mails rather than usernames (or even both), all you will need is a custom template (saying "e-mail" where it currently reads "username") and a custom backend which will try to match user accounts to the provided information.


Example code that will authenticate an user against either e-mails or usernames:



Cheers,
André Terra (airstrike)

On Sat, Apr 2, 2011 at 7:30 PM, Vjacheslav <mvjacheslav@gmail.com> wrote:
I suggest you to use django.contrib.auth app as your starting point:

1. Form:
2. View
http://code.djangoproject.com/browser/django/trunk/django/contrib/auth/views.py#L24

3. Template
> Hi All
>
> I saved the registered user data into my postgresql database.
> Now I have to create login page. I have to check the requested user
> name and password are in my database. If user name and password are in
> my database, redirect to success.html.  How should I do? Pls advise
> me.
>
> Thanks
> nge

--
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.


--
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.

No comments:

Post a Comment