Several form classes are provided with django-registration, covering common cases for gathering account information and implementing common constraints for user registration. These forms were designed with django-registration’s default backend in mind, but may also be useful in other situations.
A simple form for registering an account. Has the following fields, all of which are required:
The constraints on usernames and email addresses match those enforced by Django’s default authentication backend for instances of django.contrib.auth.models.User. The repeated entry of the password serves to catch typos.
Because it does not apply to any single field of the form, the validation error for mismatched passwords is attached to the form itself, and so must be accessed via the form’s non_field_errors() method.
A subclass of RegistrationForm which adds one additional, required field:
A subclass of RegistrationForm which enforces uniqueness of email addresses in addition to uniqueness of usernames.
A subclass of RegistrationForm which disallows registration using addresses from some common free email providers. This can, in some cases, cut down on automated registration by spambots.
By default, the following domains are disallowed for email addresses:
To change this, subclass this form and set the class attribute bad_domains to a list of domains you wish to disallow.