2014-03-06 11:45 GMT-03:00 Jack Yan <lucen...@gmail.com>:

> in the tutorial and section "Authenticating Users":
> https://docs.djangoproject.com/en/1.6/topics/auth/default/
>
> where can I put code:
>
> from django.contrib.auth import authenticateuser = 
> authenticate(username='john', password='secret')if user is not None:
>     # the password verified for the user
>     if user.is_active:
>         print("User is valid, active and authenticated")
>     else:
>         print("The password is valid, but the account has been 
> disabled!")else:
>     # the authentication system was unable to verify the username and password
>     print("The username and password were incorrect.")
>
> in what file or what folder?
>

That is described later in the same page [1].

But if you just want to enable login/logout/password reset for your
project, the easiest way is to include Django's default auth views in your
urls.py [2].

[1]
https://docs.djangoproject.com/en/1.6/topics/auth/default/#how-to-log-a-user-in
[2]
https://docs.djangoproject.com/en/1.6/topics/auth/default/#module-django.contrib.auth.views

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAP5dYfNxCPTL%2BcqK%3DHaQBhKPYQSZ-BMqKnHk7vu-vJuqg84K2Q%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to