LoginView
Handles user login with support for multiple authentication methods.Attributes
type
default:"LoginForm"
Form class to use for login.
str
Template path. Defaults to
account/login.html or .txt based on TEMPLATE_EXTENSION.str
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.LoginForm
The validated form.
HttpResponse
Response object (typically redirect).
Context Data
str
URL to signup page.
Site
Current site object.
bool
Whether social authentication is enabled.
bool
Whether passwordless login is enabled.
bool
Whether passkey login is enabled.
Usage
SignupView
Handles user registration.Attributes
type
default:"SignupForm"
Form class to use for signup.
str
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
str
URL to login page.
str
Current signup URL.
bool
Whether passkey signup is enabled.
ConfirmEmailView
Handles email confirmation via confirmation key.Attributes
str
Template path. Defaults to
account/email_confirm.html.URL Parameters
str
Email confirmation key from URL.
Methods
get_object()
Retrieves EmailConfirmation from key.EmailConfirmation
The confirmation object.
logout_other_user(confirmation)
Logs out current user if confirming for different account.EmailConfirmation
The confirmation being processed.
Context Data
EmailConfirmation
The confirmation object.
bool
Whether confirmation can proceed.
str
Email address being confirmed.
EmailView
Manages user’s email addresses.Attributes
type
default:"AddEmailForm"
Form for adding email addresses.
str
Template path. Uses
account/email.html or account/email_change.html based on CHANGE_EMAIL setting.str
default:"reverse_lazy('account_email')"
Redirect URL after actions.
Decorators
@login_required- Requires authenticated user@rate_limit(action="manage_email")- Rate limits email operations
POST Actions
submit
Adds new email address.
submit
Resends verification email.
submit
Removes email address.
submit
Sets email as primary.
Context Data
QuerySet
List of user’s email addresses.
bool
Whether user can add more emails.
EmailAddress
Pending new email (CHANGE_EMAIL mode).
EmailAddress
Current verified email (CHANGE_EMAIL mode).
PasswordChangeView
Handles password change for users with existing password.Attributes
type
default:"ChangePasswordForm"
Form for changing password.
str
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
type
default:"SetPasswordForm"
Form for setting password.
str
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
type
default:"ResetPasswordForm"
Form for requesting password reset.
str
Template path. Defaults to
account/password_reset.html.str
default:"reverse_lazy('account_reset_password_done')"
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
type
default:"ResetPasswordKeyForm"
Form for resetting password.
str
Template path. Defaults to
account/password_reset_from_key.html.str
Success redirect URL.
str
default:"set-password"
URL key for reset action.
URL Parameters
str
Base36-encoded user ID.
str
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
str
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
type
default:"ReauthenticateForm"
Form for reauthentication.
str
Template path. Defaults to
account/reauthenticate.html.Decorators
@login_required- Requires authenticated user- Rate limited via
_check_ratelimitmethod
Context Data
list
Alternative reauthentication methods (e.g., TOTP, WebAuthn).
RequestLoginCodeView
Requests a login code for passwordless authentication.Attributes
type
default:"RequestLoginCodeForm"
Form for requesting code.
str
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
type
default:"ConfirmLoginCodeForm"
Form for code verification.
str
Template path. Defaults to
account/confirm_login_code.html.Decorators
@login_stage_required- Requires active login stage@never_cache- Prevents caching
Context Data
str
Email where code was sent.
str
Phone where code was sent.
ChangePhoneView
Handles phone number changes.Attributes
type
default:"ChangePhoneForm"
Form for changing phone.
str
Template path. Defaults to
account/phone_change.html.str
default:"reverse_lazy('account_verify_phone')"
Redirect to phone verification.
Decorators
@login_required- Requires authenticated user@rate_limit(action="change_phone")- Rate limits phone changes
Context Data
str
Current phone number.
bool
Whether phone is verified.
