o
    ˷e                     @   sP   d dl mZ d dlmZ d dlmZ ddlmZ ddlm	Z	 ddefdd	Z
dS )
    )REDIRECT_FIELD_NAMElogin_required)render   )EmailAddress)send_email_confirmationNc                    s    fdd}| r|| S |S )a8  
    Even when email verification is not mandatory during signup, there
    may be circumstances during which you really want to prevent
    unverified users to proceed. This decorator ensures the user is
    authenticated and has a verified email address. If the former is
    not the case then the behavior is identical to that of the
    standard `login_required` decorator. If the latter does not hold,
    email verification mails are automatically resend and the user is
    presented with a page informing them they needs to verify their email
    address.
    c                    s   t d fdd}|S )N)redirect_field_name	login_urlc                    sB   t jj| jdd st| | j t| dS  | g|R i |S )NT)userverifiedz$account/verified_email_required.html)r   objectsfilterr   existsr   r   )requestargskwargs	view_func Q/var/www/ideatree/venv/lib/python3.10/site-packages/allauth/account/decorators.py_wrapped_view   s   
zAverified_email_required.<locals>.decorator.<locals>._wrapped_viewr   )r   r   r
   r	   r   r   	decorator   s   
z*verified_email_required.<locals>.decoratorr   )functionr
   r	   r   r   r   r   verified_email_required	   s   r   )django.contrib.authr   django.contrib.auth.decoratorsr   django.shortcutsr   modelsr   utilsr   r   r   r   r   r   <module>   s    