auth.views.logout_then_login()

logout_then_login(request, login_url=None, current_app=None, extra_context=None) Logs a user out, then redirects to the login page. URL name: No default URL provided Optional arguments: login_url: The URL of the login page to redirect to. Defaults to settings.LOGIN_URL if not supplied. current_app: A hint indicating which application contains the current view. See the namespaced URL resolution strategy for more information. extra_context: A dictionary of context data that will be added to

auth.views.logout()

logout(request, next_page=None, template_name='registration/logged_out.html', redirect_field_name='next', current_app=None, extra_context=None) Logs a user out. URL name: logout Optional arguments: next_page: The URL to redirect to after logout. Defaults to settings.LOGOUT_REDIRECT_URL if not supplied. template_name: The full name of a template to display after logging the user out. Defaults to registration/logged_out.html if no argument is supplied. redirect_field_name: The name of a GET

auth.views.login()

login(request, template_name=`registration/login.html`, redirect_field_name='next', authentication_form=AuthenticationForm, current_app=None, extra_context=None, redirect_authenticated_user=False) URL name: login See the URL documentation for details on using named URL patterns. Optional arguments: template_name: The name of a template to display for the view used to log the user in. Defaults to registration/login.html. redirect_field_name: The name of a GET field containing the URL to red

auth.validators.UnicodeUsernameValidator

class validators.UnicodeUsernameValidator New in Django 1.10. A field validator allowing Unicode letters, in addition to @, ., +, -, and _. The default validator for User.username on Python 3.

auth.validators.ASCIIUsernameValidator

class validators.ASCIIUsernameValidator New in Django 1.10. A field validator allowing only ASCII letters, in addition to @, ., +, -, and _. The default validator for User.username on Python 2.

auth.update_session_auth_hash()

update_session_auth_hash(request, user) [source] This function takes the current request and the updated user object from which the new session hash will be derived and updates the session hash appropriately. Example usage: from django.contrib.auth import update_session_auth_hash def password_change(request): if request.method == 'POST': form = PasswordChangeForm(user=request.user, data=request.POST) if form.is_valid(): form.save() update_session_

auth.signals.user_login_failed()

user_login_failed() Sent when the user failed to login successfully sender The name of the module used for authentication. credentials A dictionary of keyword arguments containing the user credentials that were passed to authenticate() or your own custom authentication backend. Credentials matching a set of ‘sensitive’ patterns, (including password) will not be sent in the clear as part of the signal.

auth.signals.user_logged_out()

user_logged_out() Sent when the logout method is called. sender As above: the class of the user that just logged out or None if the user was not authenticated. request The current HttpRequest instance. user The user instance that just logged out or None if the user was not authenticated.

auth.signals.user_logged_in()

user_logged_in() Sent when a user logs in successfully. Arguments sent with this signal: sender The class of the user that just logged in. request The current HttpRequest instance. user The user instance that just logged in.

auth.password_validation.validate_password()

validate_password(password, user=None, password_validators=None) [source] Validates a password. If all validators find the password valid, returns None. If one or more validators reject the password, raises a ValidationError with all the error messages from the validators. The user object is optional: if it’s not provided, some validators may not be able to perform any validation and will accept any password.