LoginView
Handles user login with support for multiple authentication methods.Attributes
Form class to use for login.
Template path. Defaults to
account/login.html or .txt based on TEMPLATE_EXTENSION.URL to redirect after successful login.
Decorators
@rate_limit(action="login")- Rate limits login attempts@login_not_required- Allows anonymous access@sensitive_post_parameters- Protects password in error reports@never_cache- Prevents caching
Methods
get_form_class()
Returns the form class, respectingFORMS setting.
form_valid(form)
Handles successful form submission.The validated form.
Response object (typically redirect).
Context Data
URL to signup page.
Current site object.
Whether social authentication is enabled.
Whether passwordless login is enabled.
Whether passkey login is enabled.
Usage
SignupView
Handles user registration.Attributes
Form class to use for signup.
Template path. Defaults to
account/signup.html or .txt.Decorators
@rate_limit(action="signup")- Rate limits signup attempts@login_not_required- Allows anonymous access@sensitive_post_parameters- Protects password in error reports@never_cache- Prevents caching
Methods
get_form_class()
Returns form class from settings or default.form_valid(form)
Creates user and completes signup flow.get_initial()
Pre-fills email from query parameter if provided.Context Data
URL to login page.
Current signup URL.
Whether passkey signup is enabled.
ConfirmEmailView
Handles email confirmation via confirmation key.Attributes
Template path. Defaults to
account/email_confirm.html.URL Parameters
Email confirmation key from URL.
Methods
get_object()
Retrieves EmailConfirmation from key.The confirmation object.
logout_other_user(confirmation)
Logs out current user if confirming for different account.The confirmation being processed.
Context Data
The confirmation object.
Whether confirmation can proceed.
Email address being confirmed.
EmailView
Manages user’s email addresses.Attributes
Form for adding email addresses.
Template path. Uses
account/email.html or account/email_change.html based on CHANGE_EMAIL setting.Redirect URL after actions.
Decorators
@login_required- Requires authenticated user@rate_limit(action="manage_email")- Rate limits email operations
POST Actions
Adds new email address.
Resends verification email.
Removes email address.
Sets email as primary.
Context Data
List of user’s email addresses.
Whether user can add more emails.
Pending new email (CHANGE_EMAIL mode).
Current verified email (CHANGE_EMAIL mode).
PasswordChangeView
Handles password change for users with existing password.Attributes
Form for changing password.
Template path. Defaults to
account/password_change.html.Decorators
@login_required- Requires authenticated user@rate_limit(action="change_password")- Rate limits password changes@sensitive_post_parameters- Protects passwords in error reports
Methods
dispatch(request, *args, **kwargs)
Redirects to PasswordSetView if user has no usable password.get_default_success_url()
Returns redirect URL from adapter.PasswordSetView
Handles password creation for users without existing password.Attributes
Form for setting password.
Template path. Defaults to
account/password_set.html.Decorators
@login_required- Requires authenticated user@rate_limit(action="change_password")- Rate limits password operations@sensitive_post_parameters- Protects passwords
PasswordResetView
Handles password reset request.Attributes
Form for requesting password reset.
Template path. Defaults to
account/password_reset.html.Redirect URL after request.
Decorators
@login_not_required- Allows anonymous access
Methods
form_valid(form)
Sends password reset email with rate limiting.PasswordResetFromKeyView
Handles password reset with key/token.Attributes
Form for resetting password.
Template path. Defaults to
account/password_reset_from_key.html.Success redirect URL.
URL key for reset action.
URL Parameters
Base36-encoded user ID.
Password reset token.
Decorators
@rate_limit(action="reset_password_from_key")- Rate limits reset attempts@login_not_required- Allows anonymous access
LogoutView
Handles user logout.Attributes
Template path. Defaults to
account/logout.html.Methods
get(request)
Handles GET requests. Logs out immediately ifLOGOUT_ON_GET is True.
post(request)
Handles logout confirmation.get_redirect_url()
Returns logout redirect URL from adapter.ReauthenticateView
Requires user to confirm their password.Attributes
Form for reauthentication.
Template path. Defaults to
account/reauthenticate.html.Decorators
@login_required- Requires authenticated user- Rate limited via
_check_ratelimitmethod
Context Data
Alternative reauthentication methods (e.g., TOTP, WebAuthn).
RequestLoginCodeView
Requests a login code for passwordless authentication.Attributes
Form for requesting code.
Template path. Defaults to
account/request_login_code.html.Methods
form_valid(form)
Initiates login code verification process.ConfirmLoginCodeView
Verifies login code for passwordless authentication.Attributes
Form for code verification.
Template path. Defaults to
account/confirm_login_code.html.Decorators
@login_stage_required- Requires active login stage@never_cache- Prevents caching
Context Data
Email where code was sent.
Phone where code was sent.
ChangePhoneView
Handles phone number changes.Attributes
Form for changing phone.
Template path. Defaults to
account/phone_change.html.Redirect to phone verification.
Decorators
@login_required- Requires authenticated user@rate_limit(action="change_phone")- Rate limits phone changes
Context Data
Current phone number.
Whether phone is verified.
