Jump to >


Basic utility functions for authentication.

This contains some validation functions that may be useful for forms.

Validate that the test cookie was properly set in a prior request.

If the test cookie was not set, the given form’s submit field will be set with an error saying that cookies must be enabled.

  • form (Form) – The form using the validator.
  • request (HttpRequest) – The HTTP request containing the test cookie.
validate_old_password(form, user, field_name=u’password’)[source]

Validate that the password given on a form was valid.

This is intended for Password Change forms, and will check that the specified password in the form matches the user’s current password.

  • form (Form) – The form using the validator and containing the field.
  • user (User) – The user whose password is being changed.
  • field_name (unicode) – The name of the password field.