authentication_service.views module¶
-
class
authentication_service.views.
CookieRedirectView
(**kwargs)[source]¶ Bases:
django.views.generic.base.View
Simple view that redirects in the event the client passes a cookie containing the correct key. In the event a cookie is not present, redirect to the django default login url.
User is explicitly logged out to clear the user session. In anticipation that the referrer will prompt them to login again so as to obtain the oidc tokens.
-
class
authentication_service.views.
DeleteAccountView
(**kwargs)[source]¶ Bases:
django.views.generic.edit.FormView
-
form_class
¶
-
success_url
= '/profile/edit/'¶
-
template_name
= 'authentication_service/profile/delete_account.html'¶
-
-
class
authentication_service.views.
EditProfileView
(**kwargs)[source]¶ Bases:
authentication_service.views.LanguageRedirectMixin
,django.views.generic.edit.UpdateView
-
form_class
¶
-
get_object
(queryset=None)[source]¶ Returns the object the view is displaying.
By default this requires self.queryset and a pk or slug argument in the URLconf, but subclasses can override this to return any object.
-
template_name
= 'authentication_service/profile/edit_profile.html'¶
-
-
class
authentication_service.views.
LanguageMixin
[source]¶ Bases:
object
This mixin sets an instance variable called self.language, value is passed in via url or determined by django language middleware
-
class
authentication_service.views.
LanguageRedirectMixin
[source]¶ Bases:
authentication_service.views.LanguageMixin
,authentication_service.views.RedirectMixin
Combined class for the frequently used Language and Redirect mixins. Language can safely be set on views that make no use of it.
-
class
authentication_service.views.
LockoutView
(**kwargs)[source]¶ Bases:
django.views.generic.base.TemplateView
A view used by Defender to inform the user that they have exceeded the threshold for allowed login failures or password reset attempts.
-
template_name
= 'authentication_service/lockout.html'¶
-
-
class
authentication_service.views.
LoginView
(**kwargs)[source]¶ Bases:
two_factor.views.core.LoginView
This view simply extends the LoginView from two_factor.views.core. We only override the template and the done step, which we use to login superusers.
-
dispatch
(request, *args, **kwargs)¶ This method gets called by the routing engine. The first argument is request which contains a HttpRequest instance. The request is stored in self.request for later use. The storage instance is stored in self.storage.
After processing the request using the dispatch method, the response gets updated by the storage engine (for example add cookies).
-
form_list
= (('auth', <class 'django.contrib.auth.forms.AuthenticationForm'>), ('token', <class 'two_factor.forms.AuthenticationTokenForm'>), ('backup', <class 'two_factor.forms.BackupTokenForm'>))¶
-
template_name
= 'authentication_service/login/login.html'¶
-
-
class
authentication_service.views.
PasswordResetConfirmView
(**kwargs)[source]¶ Bases:
django.contrib.auth.views.PasswordResetConfirmView
-
form_class
¶
-
-
class
authentication_service.views.
RedirectMixin
[source]¶ Bases:
object
This mixin gets the redirect URL parameter from the request URL. This URL is used as the success_url attribute. If no redirect_url is set, it will default to the Login URL.
For registration, this mixin also checks the security level of the request. If the security level is high, the success URL will redirect to 2FA setup.
TODO: Security should be moved out.
-
success_url
= None¶
-
-
class
authentication_service.views.
RegistrationView
(**kwargs)[source]¶ Bases:
authentication_service.views.LanguageRedirectMixin
,django.views.generic.edit.CreateView
-
form_class
¶
-
form_invalid
(form)[source]¶ If the form is invalid, re-render the context data with the data-filled form and errors.
-
get_formset
¶
-
security
= None¶
-
template_name
= 'authentication_service/registration/registration.html'¶
-
-
class
authentication_service.views.
ResetPasswordSecurityQuestionsView
(**kwargs)[source]¶ Bases:
django.views.generic.edit.FormView
-
dispatch
(request, *args, **kwargs)¶
-
form_class
¶ alias of
authentication_service.forms.ResetPasswordSecurityQuestionsForm
-
template_name
= 'authentication_service/reset_password/security_questions.html'¶
-
-
class
authentication_service.views.
ResetPasswordView
(**kwargs)[source]¶ Bases:
django.contrib.auth.views.PasswordResetView
This view allows the user to enter either their username or their email address in order for us to identify them. After we have identified the user we check what method to user to help them reset their password. If the user has an email address, we send them a reset link. If they have security questions, we take them to the ResetPasswordSecurityQuestionsView to enter their answers.
-
form_class
¶
-
success_url
= '/reset-password/done/'¶
-
template_name
= 'authentication_service/reset_password/reset_password.html'¶
-
-
class
authentication_service.views.
UpdatePasswordView
(**kwargs)[source]¶ Bases:
authentication_service.views.LanguageRedirectMixin
,django.contrib.auth.views.PasswordChangeView
-
form_class
¶
-
success_url
= '/profile/edit/'¶
-
template_name
= 'authentication_service/profile/update_password.html'¶
-
-
class
authentication_service.views.
UpdateSecurityQuestionsView
(**kwargs)[source]¶ Bases:
authentication_service.views.LanguageRedirectMixin
,django.views.generic.base.TemplateView
-
get_formset
¶
-
success_url
= '/profile/edit/'¶
-
template_name
= 'authentication_service/profile/update_security_questions.html'¶
-