LoginForm
Handles user login with support for username, email, or phone-based authentication.Fields
Login identifier. Field type varies based on
LOGIN_METHODS setting.User password. Omitted if passwordless login is enabled.
Remember me checkbox. Omitted if
SESSION_REMEMBER is configured.Constructor Parameters
The HTTP request object.
Methods
user_credentials()
Returns credentials dictionary for authentication.Dictionary with login method and password (if applicable).
login(request, redirect_url=None)
Performs the login action.The HTTP request object.
URL to redirect after login.
Response object (redirect or stage flow).
SignupForm
Handles user registration with configurable fields.Fields
Username field. Presence depends on
SIGNUP_FIELDS setting.Email field. Presence and requirement depends on
SIGNUP_FIELDS setting.Email confirmation field. Only if configured in
SIGNUP_FIELDS.Password field. Omitted for passkey signup.
Password confirmation. Only if configured in
SIGNUP_FIELDS.Phone number field. Only if configured in
SIGNUP_FIELDS.Constructor Parameters
Whether this is a passkey-based signup.
Override email field requirement.
Override username field requirement.
Methods
validate_unique_email(value)
Validates email uniqueness and handles enumeration prevention.Email address to validate.
Returns the validated email.
try_save(request)
Attempts to save the user, handling account conflicts.The HTTP request object.
Returns
(user, response) tuple. Response is set if enumeration prevention triggered.save(request)
Creates and saves the new user.The HTTP request object.
Returns the created user object.
custom_signup(request, user)
Hook for custom signup logic. Override in subclasses.The HTTP request object.
The newly created user.
AddEmailForm
Form for adding additional email addresses to an account.Fields
The email address to add.
Constructor Parameters
The user adding the email address.
Methods
save(request)
Adds the email address to the user’s account.The HTTP request object.
Returns the created EmailAddress object.
ChangePasswordForm
Form for changing password when user knows their current password.Fields
Current password.
New password.
New password confirmation.
Constructor Parameters
The user changing their password.
Methods
save()
Changes the user’s password.SetPasswordForm
Form for setting password when user doesn’t have a usable password.Fields
New password.
Password confirmation.
Constructor Parameters
The user setting their password.
Methods
save()
Sets the user’s password.ResetPasswordForm
Form for requesting a password reset.Fields
Email address to send reset link to.
Methods
save(request, **kwargs)
Initiates password reset flow.The HTTP request object.
Custom token generator.
Returns the email address.
ResetPasswordKeyForm
Form for completing password reset with a key/token.Fields
New password.
Password confirmation.
Constructor Parameters
The user resetting their password.
The temporary reset key.
Methods
save()
Resets the user’s password.RequestLoginCodeForm
Form for requesting a login code (passwordless login).Fields
Email to send code to. Required if phone not enabled.
Phone to send code to. Only present if phone login enabled.
Usage
ConfirmLoginCodeForm
Form for verifying a login code.Fields
The verification code.
Constructor Parameters
Expected code for validation.
ReauthenticateForm
Form for reauthenticating an already logged-in user.Fields
Current password for verification.
Constructor Parameters
The user to reauthenticate.
ChangeEmailForm
Form for changing email address with verification.Fields
New email address.
Constructor Parameters
Current email address.
ChangePhoneForm
Form for changing phone number with verification.Fields
New phone number.
Constructor Parameters
The user changing their phone.
Current phone number.
