Authentication
This package contains views related to login, logout and password reset functionality as well as 2FA authentication:
- Webauthn
- Webauthn Assert View
- Webauthn Login View
WebAuthnLoginViewWebAuthnLoginView.__init__()WebAuthnLoginView.as_view()WebAuthnLoginView.authentication_formWebAuthnLoginView.content_typeWebAuthnLoginView.dispatch()WebAuthnLoginView.extra_contextWebAuthnLoginView.form_classWebAuthnLoginView.form_invalid()WebAuthnLoginView.form_valid()WebAuthnLoginView.get()WebAuthnLoginView.get_context_data()WebAuthnLoginView.get_default_redirect_url()WebAuthnLoginView.get_form()WebAuthnLoginView.get_form_class()WebAuthnLoginView.get_form_kwargs()WebAuthnLoginView.get_initial()WebAuthnLoginView.get_prefix()WebAuthnLoginView.get_redirect_url()WebAuthnLoginView.get_success_url()WebAuthnLoginView.get_success_url_allowed_hosts()WebAuthnLoginView.get_template_names()WebAuthnLoginView.http_method_namesWebAuthnLoginView.http_method_not_allowed()WebAuthnLoginView.initialWebAuthnLoginView.next_pageWebAuthnLoginView.options()WebAuthnLoginView.post()WebAuthnLoginView.prefixWebAuthnLoginView.put()WebAuthnLoginView.redirect_authenticated_userWebAuthnLoginView.redirect_field_nameWebAuthnLoginView.render_to_response()WebAuthnLoginView.response_classWebAuthnLoginView.setup()WebAuthnLoginView.success_urlWebAuthnLoginView.success_url_allowed_hostsWebAuthnLoginView.template_engineWebAuthnLoginView.template_nameWebAuthnLoginView.view_is_async
- Webauthn Verify View
Account Activation View
- class integreat_cms.cms.views.authentication.account_activation_view.AccountActivationView(**kwargs)[source]
Bases:
PasswordResetConfirmViewView to set a new password and activate and account.
- __init__(**kwargs)[source]
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
- dispatch(*args: Any, **kwargs: Any) HttpResponse[source]
The view part of the view. Handles all HTTP methods equally.
- Parameters:
*args (Any) – The supplied arguments
**kwargs (Any) – The supplied keyword arguments
- Returns:
The rendered template response or a redirection to the login page
- Return type:
HttpResponse
- form_class[source]
alias of
SetPasswordForm
- form_valid(form: SetPasswordForm) HttpResponse[source]
If the form is valid, show a success message.
- Parameters:
form (SetPasswordForm) – The supplied form
- Returns:
A redirection to the
success_url- Return type:
HttpResponse
- get(request, *args, **kwargs)[source]
Handle GET requests: instantiate a blank version of the form.
- get_template_names()[source]
Return a list of template names to be used for the request. Must return a list. May not be called if render_to_response() is overridden.
- post(request, *args, **kwargs)[source]
Handle POST requests: instantiate a form instance with the passed POST variables and then check if it’s valid.
- render_to_response(context, **response_kwargs)[source]
Return a response, using the response_class for this view, with a template rendered with the given context.
Pass response_kwargs to the constructor of the response class.
- response_class[source]
alias of
TemplateResponse
- template_name = 'authentication/account_activation_form.html'[source]
The template which should be rendered
- token_generator = <integreat_cms.cms.utils.account_activation_token_generator.AccountActivationTokenGenerator object>[source]
The generator for activation tokens (use
AccountActivationTokenGeneratorinstead of the default one to make sure password reset tokens are not accepted for account activation and vice versa)
Login View
- class integreat_cms.cms.views.authentication.login_view.LoginView(**kwargs)[source]
Bases:
LoginViewView to extend the default login behavior from
LoginViewwith multi-factor-authentication.- __init__(**kwargs)[source]
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
- form_class[source]
alias of
AuthenticationForm
- form_valid(form: AuthenticationForm) HttpResponseRedirect[source]
This function overwrites
form_valid()which is called if the login form is valid. In case the user has mfa-keys configured, the login is delegated toWebAuthnLoginView. Else, the default methodlogin()is used to log the user in. After that, the user is redirected toLOGIN_REDIRECT_URL.- Parameters:
form (AuthenticationForm) – User login form
- Returns:
Redirect user to mfa login view or to
LOGIN_REDIRECT_URL- Return type:
HttpResponseRedirect
- get(request, *args, **kwargs)[source]
Handle GET requests: instantiate a blank version of the form.
- get_template_names()[source]
Return a list of template names to be used for the request. Must return a list. May not be called if render_to_response() is overridden.
- post(request, *args, **kwargs)[source]
Handle POST requests: instantiate a form instance with the passed POST variables and then check if it’s valid.
- redirect_authenticated_user = True[source]
A boolean that controls whether or not authenticated users accessing the login page will be redirected as if they had just successfully logged in.
- render_to_response(context, **response_kwargs)[source]
Return a response, using the response_class for this view, with a template rendered with the given context.
Pass response_kwargs to the constructor of the response class.
- response_class[source]
alias of
TemplateResponse
- template_name = 'authentication/login.html'[source]
The template to render (see
TemplateResponseMixin)
Logout View
- class integreat_cms.cms.views.authentication.logout_view.LogoutView(**kwargs)[source]
Bases:
LogoutViewView to log off a user
- __init__(**kwargs)[source]
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
- dispatch(request: HttpRequest, *args: Any, **kwargs: Any) HttpResponse[source]
This function sends message, if logout was successful
- Parameters:
request (HttpRequest) – The current request
*args (Any) – The supplied arguments
**kwargs (Any) – The supplied keyword arguments
- Returns:
passes form to dispatch function
- Return type:
HttpResponse
- get_template_names()[source]
Return a list of template names to be used for the request. Must return a list. May not be called if render_to_response() is overridden.
- render_to_response(context, **response_kwargs)[source]
Return a response, using the response_class for this view, with a template rendered with the given context.
Pass response_kwargs to the constructor of the response class.
- response_class[source]
alias of
TemplateResponse
Password Reset Confirm View
- class integreat_cms.cms.views.authentication.password_reset_confirm_view.PasswordResetConfirmView(**kwargs)[source]
Bases:
PasswordResetConfirmViewView to confirm that the password should be reset
- __init__(**kwargs)[source]
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
- dispatch(*args: Any, **kwargs: Any) HttpResponse[source]
The view part of the view. Handles all HTTP methods equally.
- Parameters:
*args (Any) – The supplied arguments
**kwargs (Any) – The supplied keyword arguments
- Returns:
The rendered template response or a redirection to the password reset page
- Return type:
HttpResponse
- form_class[source]
alias of
SetPasswordForm
- form_valid(form: SetPasswordForm) HttpResponse[source]
If the form is valid, show a success message.
- Parameters:
form (SetPasswordForm) – The supplied form
- Returns:
form validation
- Return type:
HttpResponse
- get(request, *args, **kwargs)[source]
Handle GET requests: instantiate a blank version of the form.
- get_template_names()[source]
Return a list of template names to be used for the request. Must return a list. May not be called if render_to_response() is overridden.
- post(request, *args, **kwargs)[source]
Handle POST requests: instantiate a form instance with the passed POST variables and then check if it’s valid.
- render_to_response(context, **response_kwargs)[source]
Return a response, using the response_class for this view, with a template rendered with the given context.
Pass response_kwargs to the constructor of the response class.
- response_class[source]
alias of
TemplateResponse
Password Reset View
- class integreat_cms.cms.views.authentication.password_reset_view.PasswordResetView(**kwargs)[source]
Bases:
PasswordResetViewView to extend the default login behaviour from
LoginViewwith multi-factor-authentication.- __init__(**kwargs)[source]
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
- dispatch(*args: HttpRequest, **kwargs: Any) HttpResponseRedirect | TemplateResponse[source]
The view part of the view. Handles all HTTP methods equally.
- Parameters:
*args (HttpRequest) – The supplied arguments
**kwargs (Any) – The supplied keyword arguments
- Returns:
The rendered template response or a redirection
- Return type:
HttpResponseRedirect | TemplateResponse
- email_template_name = 'emails/password_reset_email.txt'[source]
The full name of a template to use for generating the email with the reset password link.
- form_class[source]
The form for the password reset
Form fields:
email: Email (EmailField)
alias of
CustomPasswordResetForm
- form_valid(form: CustomPasswordResetForm) HttpResponseRedirect[source]
This function validates the form and sends a message depending if the function was executed successfully
- Parameters:
form (CustomPasswordResetForm) – The supplied form
- Returns:
passes form to form validation
- Return type:
HttpResponseRedirect
- get(request, *args, **kwargs)[source]
Handle GET requests: instantiate a blank version of the form.
- get_template_names()[source]
Return a list of template names to be used for the request. Must return a list. May not be called if render_to_response() is overridden.
- html_email_template_name = 'emails/password_reset_email.html'[source]
The full name of a template to use for generating the html email with the reset password link.
- post(request, *args, **kwargs)[source]
Handle POST requests: instantiate a form instance with the passed POST variables and then check if it’s valid.
- render_to_response(context, **response_kwargs)[source]
Return a response, using the response_class for this view, with a template rendered with the given context.
Pass response_kwargs to the constructor of the response class.
- response_class[source]
alias of
TemplateResponse
- success_url = '/reset-password/'[source]
If the password reset process was successfully initialized, stay on the password reset page
Passwordless Login View
- class integreat_cms.cms.views.authentication.passwordless_login_view.PasswordlessLoginView(**kwargs)[source]
Bases:
LoginViewView to extend the default login behavior from
LoginViewwith multi-factor-authentication.- __init__(**kwargs)[source]
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
- form_class[source]
The form class for the passwordless login
Form fields:
username: Username (UsernameField)
alias of
PasswordlessAuthenticationForm
- form_valid(form: PasswordlessAuthenticationForm) HttpResponseRedirect[source]
This function overwrites
form_valid()which is called if the login form is valid. In case the user has mfa-keys configured, the login is delegated toWebAuthnLoginVieworTOTPLoginView. Else, the default methodlogin()is used to log the user in. After that, the user is redirected toLOGIN_REDIRECT_URL.- Parameters:
form (PasswordlessAuthenticationForm) – User login form
- Returns:
Redirect user to mfa login view or to
LOGIN_REDIRECT_URL- Return type:
HttpResponseRedirect
- get(request, *args, **kwargs)[source]
Handle GET requests: instantiate a blank version of the form.
- get_template_names()[source]
Return a list of template names to be used for the request. Must return a list. May not be called if render_to_response() is overridden.
- post(request, *args, **kwargs)[source]
Handle POST requests: instantiate a form instance with the passed POST variables and then check if it’s valid.
- redirect_authenticated_user = True[source]
A boolean that controls whether or not authenticated users accessing the login page will be redirected as if they had just successfully logged in.
- render_to_response(context, **response_kwargs)[source]
Return a response, using the response_class for this view, with a template rendered with the given context.
Pass response_kwargs to the constructor of the response class.
- response_class[source]
alias of
TemplateResponse
- template_name = 'authentication/passwordless_login.html'[source]
The template to render (see
TemplateResponseMixin)
Totp Login View
- class integreat_cms.cms.views.authentication.totp_login_view.TOTPLoginView(**kwargs)[source]
Bases:
TemplateViewView to extend the default login behavior from
LoginViewwith multi-factor-authentication using TOTP.- __init__(**kwargs)[source]
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
- dispatch(request: HttpRequest, *args: Any, **kwargs: Any) HttpResponse[source]
Check whether TOTP login can be used right now
- Parameters:
request (HttpRequest) – The current request
*args (Any) – The supplied arguments
**kwargs (Any) – The supplied keyword arguments
- Returns:
Redirection to login form or region selection
- Return type:
HttpResponse
- get_template_names()[source]
Return a list of template names to be used for the request. Must return a list. May not be called if render_to_response() is overridden.
- post(request: HttpRequest, *args: Any, **kwargs: Any) HttpResponse[source]
Retrieves the entered TOTP code of the user and validates it.
- Parameters:
request (HttpRequest) – The current request
*args (Any) – The supplied arguments
**kwargs (Any) – The supplied keyword arguments
- Returns:
Redirection to region selection or rendered login form
- Return type:
HttpResponse
- render_to_response(context, **response_kwargs)[source]
Return a response, using the response_class for this view, with a template rendered with the given context.
Pass response_kwargs to the constructor of the response class.
- response_class[source]
alias of
TemplateResponse
- template_name: str = 'authentication/login_totp.html'[source]
The template to render (see
TemplateResponseMixin)