auth.hashers.make_password()

make_password(password, salt=None, hasher='default') [source] Creates a hashed password in the format used by this application. It takes one mandatory argument: the password in plain-text. Optionally, you can provide a salt and a hashing algorithm to use, if you don’t want to use the defaults (first entry of PASSWORD_HASHERS setting). See Included hashers for the algorithm name of each hasher. If the password argument is None, an unusable password is returned (a one that will be never accept

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

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

auth.forms.SetPasswordForm

class SetPasswordForm A form that lets a user change their password without entering the old 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

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