Views
LoggedOutMixin
- class password_policies.views.LoggedOutMixin(**kwargs)
A view mixin which verifies that the user has not authenticated.
Note
This should be the left-most mixin of a view.
PasswordChangeDoneView
- class password_policies.views.PasswordChangeDoneView(**kwargs)
Bases:
TemplateViewA view to redirect to after a successfull change of a user’s password.
- template_name = 'registration/password_change_done.html'
The template used by this view. Defaults to the same template used by
django.contrib.views.password_change_done().
PasswordChangeFormView
- class password_policies.views.PasswordChangeFormView(**kwargs)
Bases:
FormViewA view that allows logged in users to change their password.
- form_class
The form used by this view.
- old_password
CharField(Required)
- Parameters:
error_messages – {‘required’: ‘This field is required.’}
localize – False
validators – [’
ProhibitNullCharactersValidator’]widget – PasswordInput
- new_password1
PasswordPoliciesField(Required)
- Parameters:
error_messages – {‘required’: ‘This field is required.’}
localize – False
validators – [’
CommonSequenceValidator’, ‘ConsecutiveCountValidator’, ‘CracklibValidator’, ‘DictionaryValidator’, ‘LetterCountValidator’, ‘LowercaseLetterCountValidator’, ‘UppercaseLetterCountValidator’, ‘NumberCountValidator’, ‘SymbolCountValidator’, ‘EntropyValidator’, ‘NotEmailValidator’, ‘MinLengthValidator’, ‘ProhibitNullCharactersValidator’]widget – PasswordInput
- new_password2
CharField(Required)
- Parameters:
error_messages – {‘required’: ‘This field is required.’}
localize – False
validators – [’
ProhibitNullCharactersValidator’]widget – PasswordInput
alias of
PasswordPoliciesChangeForm
- success_url = None
An URL to redirect to after the form has been successfully validated.
- template_name = 'registration/password_change_form.html'
The template used by this view. Defaults to the same template used by
django.contrib.views.password_change().
- redirect_field_name = 'next'
doc
- form_valid(form)
If the form is valid, redirect to the supplied URL.
- get_form(form_class=None)
Return an instance of the form to be used in this view.
- get_success_url()
Returns a query string field with a previous URL if available (Mimicing the login view. Used on forced password changes, to know which URL the user was requesting before the password change.) If not returns the
success_urlattribute if set, otherwise the URL to thePasswordChangeDoneView.
- get_context_data(**kwargs)
Insert the form into the context dict.
PasswordResetCompleteView
- class password_policies.views.PasswordResetCompleteView(**kwargs)
Bases:
LoggedOutMixin,TemplateViewA view to redirect to after a password reset has been successfully confirmed.
- template_name = 'registration/password_reset_complete.html'
The template used by this view. Defaults to the same template used by
django.contrib.views.password_reset_complete().
- get_context_data(**kwargs)
Adds the login URL to redirect to (defaults to the LOGIN_URL setting in Django) to the view’s context.
PasswordResetConfirmView
- class password_policies.views.PasswordResetConfirmView(**kwargs)
Bases:
LoggedOutMixin,FormView- form_class
The form used by this view.
- new_password1
PasswordPoliciesField(Required)
- Parameters:
error_messages – {‘required’: ‘This field is required.’}
localize – False
validators – [’
CommonSequenceValidator’, ‘ConsecutiveCountValidator’, ‘CracklibValidator’, ‘DictionaryValidator’, ‘LetterCountValidator’, ‘LowercaseLetterCountValidator’, ‘UppercaseLetterCountValidator’, ‘NumberCountValidator’, ‘SymbolCountValidator’, ‘EntropyValidator’, ‘NotEmailValidator’, ‘MinLengthValidator’, ‘ProhibitNullCharactersValidator’]widget – PasswordInput
- new_password2
CharField(Required)
- Parameters:
error_messages – {‘required’: ‘This field is required.’}
localize – False
validators – [’
ProhibitNullCharactersValidator’]widget – PasswordInput
alias of
PasswordPoliciesForm
- success_url = None
An URL to redirect to after the form has been successfully validated.
- template_name = 'registration/password_reset_confirm.html'
The template used by this view. Defaults to the same template used by
django.contrib.views.password_reset_confirm().
- form_valid(form)
If the form is valid, redirect to the supplied URL.
- get(request, *args, **kwargs)
Handle GET requests: instantiate a blank version of the form.
- get_context_data(**kwargs)
Insert the form into the context dict.
- get_form(form_class=None)
Return an instance of the form to be used in this view.
- get_success_url()
Redirects to
success_urlif set, otherwise to thePasswordResetCompleteView.
- post(request, *args, **kwargs)
Handle POST requests: instantiate a form instance with the passed POST variables and then check if it’s valid.
PasswordResetDoneView
- class password_policies.views.PasswordResetDoneView(**kwargs)
Bases:
LoggedOutMixin,TemplateViewA view to redirect to after a password reset has been requested.
- template_name = 'registration/password_reset_done.html'
The template used by this view. Defaults to the same template used by
django.contrib.views.password_reset_done().
PasswordResetFormView
- class password_policies.views.PasswordResetFormView(**kwargs)
Bases:
LoggedOutMixin,FormViewA view that allows registered users to change their password.
- email_template_name = 'registration/password_reset_email.txt'
A relative path to a template in the root of a template directory to generate the body of the mail.
- email_html_template_name = 'registration/password_reset_email.html'
A relative path to a template in the root of a template directory to generate the HTML attachment of the mail.
- form_class
The form used by this view.
- email
EmailField(Required)
- Parameters:
error_messages – {‘required’: ‘This field is required.’}
localize – False
validators – [’
EmailValidator’, ‘MaxLengthValidator’, ‘ProhibitNullCharactersValidator’]widget – EmailInput
alias of
PasswordResetForm
- from_email = None
The email address to use as sender of the email.
- is_admin_site = False
Determines wether this view is used by an admin site. Overrides domain and site name if set to
True.
- subject_template_name = 'registration/password_reset_subject.txt'
A relative path to a template in the root of a template directory to generate the subject of the mail.
- success_url = None
An URL to redirect to after the form has been successfully validated.
- template_name = 'registration/password_reset_form.html'
The template used by this view. Defaults to the same template used by
django.contrib.views.password_reset().
- form_valid(form)
If the form is valid, redirect to the supplied URL.
- get_success_url()
Redirects to
success_urlif set, otherwise to thePasswordResetDoneView.