SignupView
Handles social account signup when additional information is required from the user.Class Definition
Attributes
type
The form class to use. Defaults to
SignupForm.str
Template path. Defaults to
socialaccount/signup.html or socialaccount/signup.ajax based on ACCOUNT_TEMPLATE_EXTENSION.SocialLogin
The pending social login instance (set during dispatch).
Methods
dispatch()
HttpRequest
The Django request object.
HttpResponse
The HTTP response, or redirect to login if no pending signup.
- Retrieves pending social login from session
- Redirects to login page if no pending signup found
- Proceeds with normal dispatch if signup is pending
get_form_class()
type
Form class from
SOCIALACCOUNT_FORMS['signup'] or default SignupForm.get_form_kwargs()
dict
Dictionary including the
sociallogin parameter.is_open()
bool
True if signup is open, False otherwise.
adapter.is_open_for_signup(request, sociallogin)
form_valid()
SignupForm
The validated form instance.
HttpResponse
Redirect response after successful signup.
- Creates user account with form data
- Connects social account to user
- Logs user in
- Redirects to next URL or default location
get_context_data()
dict
Context dictionary including
site and account.get_authenticated_redirect_url()
str
URL to the connections page.
URL Configuration
Template Context
The template receives:form- The signup formsite- The current siteaccount- The social account being connectedprovider- The provider instance
Function-based View
LoginCancelledView
Displays a page when the user cancels social authentication.Class Definition
Attributes
str
Template path. Defaults to
socialaccount/login_cancelled.html.Usage
This view is shown when:- User clicks “Cancel” on the provider’s authorization page
- Provider redirects back with error indicating cancellation
URL Configuration
Template Example
Function-based View
LoginErrorView
Displays an error page when social authentication fails.Class Definition
Attributes
str
Template path. Defaults to
socialaccount/authentication_error.html.Methods
get()
HttpRequest
The Django request object.
HttpResponse
HTTP response with 401 Unauthorized status.
Usage
This view is shown when:- Provider returns an error during authentication
- OAuth flow fails due to invalid state
- Provider denies access
- Token exchange fails
URL Configuration
Template Example
Function-based View
ConnectionsView
Manages connected social accounts for authenticated users.Class Definition
Attributes
str
Template path. Defaults to
socialaccount/connections.html.type
The form class to use. Defaults to
DisconnectForm.str
URL to redirect to after successful disconnection. Defaults to
socialaccount_connections.Methods
get_form_class()
type
Form class from
SOCIALACCOUNT_FORMS['disconnect'] or default DisconnectForm.get_form_kwargs()
dict
Dictionary including the
request parameter.form_valid()
DisconnectForm
The validated form instance.
HttpResponse
Redirect to success URL.
get_ajax_data()
dict
Dictionary with
socialaccounts list containing account data.URL Configuration
Template Context
The template receives:form- The disconnect formsocialaccounts- QuerySet of user’s social accounts (via form.accounts)
