auth.logout()

logout(request) [source] To log out a user who has been logged in via django.contrib.auth.login(), use django.contrib.auth.logout() within your view. It takes an HttpRequest object and has no return value. Example: from django.contrib.auth import logout def logout_view(request): logout(request) # Redirect to a success page. Note that logout() doesn’t throw any errors if the user wasn’t logged in. When you call logout(), the session data for the current request is completely cleaned

auth.forms.UserChangeForm

class UserChangeForm A form used in the admin interface to change a user’s information and permissions.

auth.hashers.is_password_usable()

is_password_usable(encoded_password) [source] Checks if the given string is a hashed password that has a chance of being verified against check_password().

auth.hashers.check_password()

check_password(password, encoded) [source] If you’d like to manually authenticate a user by comparing a plain-text password to the hashed password in the database, use the convenience function check_password(). It takes two arguments: the plain-text password to check, and the full value of a user’s password field in the database to check against, and returns True if they match, False otherwise.

auth.get_user_model()

get_user_model() [source] Instead of referring to User directly, you should reference the user model using django.contrib.auth.get_user_model(). This method will return the currently active User model – the custom User model if one is specified, or User otherwise. When you define a foreign key or many-to-many relations to the User model, you should specify the custom model using the AUTH_USER_MODEL setting. For example: from django.conf import settings from django.db import models class Art

auth.get_user()

get_user(request) [source] Returns the user model instance associated with the given request’s session. It checks if the authentication backend stored in the session is present in AUTHENTICATION_BACKENDS. If so, it uses the backend’s get_user() method to retrieve the user model instance and then verifies the session by calling the user model’s get_session_auth_hash() method. Returns an instance of AnonymousUser if the authentication backend stored in the session is no longer in AUTHENTICATIO

auth.forms.UserCreationForm

class UserCreationForm A ModelForm for creating a new user. It has three fields: username (from the user model), password1, and password2. It verifies that password1 and password2 match, validates the password using validate_password(), and sets the user’s password using set_password().

auth.forms.PasswordResetForm

class PasswordResetForm A form for generating and emailing a one-time use link to reset a user’s password. send_email(subject_template_name, email_template_name, context, from_email, to_email, html_email_template_name=None) Uses the arguments to send an EmailMultiAlternatives. Can be overridden to customize how the email is sent to the user. Parameters: subject_template_name – the template for the subject. email_template_name – the template for the email body. context – context passed

auth.forms.PasswordChangeForm

class PasswordChangeForm A form for allowing a user to change their password.

auth.forms.PasswordResetForm.send_email()

send_email(subject_template_name, email_template_name, context, from_email, to_email, html_email_template_name=None) Uses the arguments to send an EmailMultiAlternatives. Can be overridden to customize how the email is sent to the user. Parameters: subject_template_name – the template for the subject. email_template_name – the template for the email body. context – context passed to the subject_template, email_template, and html_email_template (if it is not None). from_email – the sende