Using Django authentication views

Django includes several forms and views in the authentication framework that you can use straight away. The login view you have created is a good exercise to understand the process of user authentication in Django. However, you can use the default Django authentication views in most cases.

Django provides the following class-based views to deal with authentication. All of them are located in django.contrib.auth.views:

  • LoginView: Handles a login form and logs in a user
  • LogoutView: Logs out a user

Django provides the following views to handle password changes:

  • PasswordChangeView: Handles a form to change the user password
  • PasswordChangeDoneView: The success view the user is redirected to after a successful ...

Get Django 2 by Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.