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: django.views.generic.base.TemplateView

A 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: django.views.generic.edit.FormView

A 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 – {u’required’: u’This field is required.’}
  • localize – False
  • widget – PasswordInput
new_password1

PasswordPoliciesField (Required)

Parameters:
new_password2

CharField (Required)

Parameters:
  • error_messages – {u’required’: u’This field is required.’}
  • localize – False
  • 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

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_url attribute if set, otherwise the URL to the PasswordChangeDoneView.

PasswordResetCompleteView

class password_policies.views.PasswordResetCompleteView(**kwargs)

Bases: password_policies.views.LoggedOutMixin, django.views.generic.base.TemplateView

A 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: password_policies.views.LoggedOutMixin, django.views.generic.edit.FormView

form_class

The form used by this view.

new_password1

PasswordPoliciesField (Required)

Parameters:
new_password2

CharField (Required)

Parameters:
  • error_messages – {u’required’: u’This field is required.’}
  • localize – False
  • 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().

get_success_url()

Redirects to success_url if set, otherwise to the PasswordResetCompleteView.

PasswordResetDoneView

class password_policies.views.PasswordResetDoneView(**kwargs)

Bases: password_policies.views.LoggedOutMixin, django.views.generic.base.TemplateView

A 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: password_policies.views.LoggedOutMixin, django.views.generic.edit.FormView

A 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 – {u’required’: u’This field is required.’}
  • help_text – help
  • localize – False
  • validators – [‘EmailValidator‘, ‘MaxLengthValidator‘]
  • 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().

get_success_url()

Redirects to success_url if set, otherwise to the PasswordResetDoneView.