Waldo provides abstract MultiViews to handle several levels of common authentication:
Handles exclusively methods and views related to logging users in and out.
A django form class which will be used for the authentication process. Default: WaldoAuthenticationForm.
Figures out and stores where a user should end up after landing on a page (like the login page) because they have not fulfilled some kind of requirement.
Returns the location which a user should be redirected to after fulfilling a requirement (like logging in).
Renders the login_page with an instance of the login_form for the given HttpRequest.
Logs the given HttpRequest out, redirecting the user to the page they just left or to the get_absolute_url() for the request.node.
Wraps a view function to require that the user be logged in.
Adds support for password setting, resetting, and changing to the LoginMultiView. Password reset support includes handling of a confirmation email.
A ForeignKey to the Page which will be used to render the password reset request form.
A ForeignKey to the Page which will be used to render the password reset confirmation email.
A ForeignKey to the Page which will be used to render the password setting form (i.e. the page that users will see after confirming a password reset).
A ForeignKey to the Page which will be used to render the password change form.
The password change form class. Default: django.contrib.auth.forms.PasswordChangeForm.
The password set form class. Default: django.contrib.auth.forms.SetPasswordForm.
The password reset request form class. Default: django.contrib.auth.forms.PasswordResetForm.
Generates a confirmation link for an arbitrary action, such as a password reset.
Parameters: |
|
---|
Sends a confirmation email for an arbitrary action, such as a password reset. If the page‘s Template has a mimetype of text/html, then the email will be sent with an HTML alternative version.
Parameters: |
|
---|
Handles the process by which users request a password reset, and generates the context for the confirmation email. That context will contain:
Parameters: | token_generator – The token generator to use for the confirmation link. |
---|
Checks that token` is valid, and if so, renders an instance of password_set_form with password_set_page.
Parameters: | token_generator – The token generator used to check the token. |
---|
Renders an instance of password_change_form with password_change_page.
Adds support for user registration to the PasswordMultiView.
A ForeignKey to the Page which will be used to render the registration confirmation email.
The registration form class. Default: RegistrationForm.
Renders the register_page with an instance of registration_form in the context as form. If the form has been submitted, sends a confirmation email using register_confirmation_email and the same context as PasswordMultiView.password_reset().
Parameters: | token_generator – The token generator to use for the confirmation link. |
---|
Checks that token is valid, and if so, logs the user in and redirects them to post_register_confirm_redirect().
Parameters: | token_generator – The token generator used to check the token. |
---|
Returns an HttpResponseRedirect for post-registration-confirmation. Default: Node.get_absolute_url() for request.node.
Adds support for user accounts on top of the RegistrationMultiView. By default, the account consists of the first_name, last_name, and email fields of the User model. Using a different account model is as simple as replacing account_form with any form class that takes an auth.User instance as the first argument.
A ForeignKey to the Page which will be used to render the account management form.
A ForeignKey to a Page which will be used to render an email change confirmation email. This is optional; if it is left blank, then email changes will be performed without confirmation.
A django form class which will be used to manage the user’s account. Default: UserAccountForm
Renders the manage_account_page with an instance of account_form in the context as form. If the form has been posted, the user’s email was changed, and email_change_confirmation_email is not None, sends a confirmation email to the new email to make sure it exists before making the change. The email will have the same context as PasswordMultiView.password_reset().
Parameters: | token_generator – The token generator to use for the confirmation link. |
---|
Returns True if the user has a valid account and False otherwise.
Wraps a view function to allow access only to users with valid accounts and otherwise redirect them to the account_view().
Automatically redirects users to the account_view() after registration.
Checks that token is valid, and if so, changes the user’s email.
Parameters: | token_generator – The token generator used to check the token. |
---|
Displays an HTML5 email input on browsers which support it and a normal text input on other browsers.
Handles user registration. If recaptcha_django is installed on the system and recaptcha_django.middleware.ReCaptchaMiddleware is in settings.MIDDLEWARE_CLASSES, then a recaptcha field will automatically be added to the registration form.
See also
An EmailField using the EmailInput widget.
Handles a user’s account - by default, auth.User.first_name, auth.User.last_name, auth.User.email.
Returns True if the email field changed value and False if it did not, or if there is no email field on the form. This method must be supplied by account forms used with waldo.
ModelForms modify their instances in-place during _post_clean(); this method resets the email value to its initial state and returns the altered value. This is a method on the form to allow unusual behavior such as storing email on a UserProfile.
Given a valid instance and an email address, correctly set the email address for that instance and save the changes. This is a class method in order to allow unusual behavior such as storing email on a UserProfile.
Handles user authentication. Checks that the user has not mistakenly entered their email address (like django.contrib.admin.forms.AdminAuthenticationForm) but does not require that the user be staff.
Based on django.contrib.auth.tokens. Supports the following settings:
Strategy object used to generate and check tokens for the user registration mechanism.
Strategy object used to generate and check tokens for a user email change mechanism.