| 1 |
Decorators |
| 2 |
========== |
| 3 |
|
| 4 |
Verified Email Required |
| 5 |
------------------------ |
| 6 |
|
| 7 |
Even when email verification is not mandatory during signup, there |
| 8 |
may be circumstances during which you really want to prevent |
| 9 |
unverified users from proceeding. For this purpose you can use the |
| 10 |
following decorator:: |
| 11 |
|
| 12 |
from allauth.account.decorators import verified_email_required |
| 13 |
|
| 14 |
@verified_email_required |
| 15 |
def verified_users_only_view(request): |
| 16 |
... |
| 17 |
|
| 18 |
The behavior is as follows: |
| 19 |
|
| 20 |
- If the user isn't logged in, it acts identically to the |
| 21 |
``login_required`` decorator. |
| 22 |
|
| 23 |
- If the user is logged in but has no verified email address, an |
| 24 |
email verification mail is automatically resent and the user is |
| 25 |
presented with a page informing them they need to verify their email |
| 26 |
address. |