
    Tњh                         S SK Jr  S SKJr  S SKJr  S SKJr  S SKJ	r	  S SK
Jr  S SKJr  S SKJr  S S	KJr  S SKJr  S
\SS4S jrSS jrg)    wraps)messages)AbstractBaseUser)ValidationError)HttpResponseRedirect)reverse)get_adapter)EmailAddress)app_settingsuserreturnNc                     [         R                  (       a  g[        R                  R	                  U R
                  SS9R                  5       (       + nU(       d  [        5       R                  S5      eg)z
If we would allow users to enable 2FA with unverified email address,
that would allow for an attacker to signup, not verify and prevent the real
owner of the account from ever regaining access.
NF)user_idverifiedunverified_email)	r   ALLOW_UNVERIFIED_EMAILr   objectsfilterpkexistsr
   validation_error)r   email_verifieds     YD:\Anime\Ugyen\janka_web_project\venv\Lib\site-packages\allauth/mfa/internal/flows/add.pyvalidate_can_add_authenticatorr      s^     **%--44% 5 fhN m,,-?@@     c                 *    S nU (       a  U" U 5      $ U$ )Nc                 0   ^  [        T 5      U 4S j5       nU$ )Nc                 L  > U R                   R                  (       a   [        U R                   5        T" U /UQ70 UD6$ ! [         aZ  nUR                   H,  n[        5       nUR                  U [        R                  US9  M.     [        [        S5      5      s S nA$ S nAff = f)N)message	mfa_index)
r   is_authenticatedr   r   r   get_account_adapteradd_messageERRORr   r	   )requestargskwargser    adapter	view_funcs         r   _wrapper_viewEredirect_if_add_not_allowed.<locals>.decorator.<locals>._wrapper_view    s    ||,,F27<<@ W6t6v66 ' F#$::"5"7++GX^^W+U $. 00DEE	Fs   ? 
B#	ABB#B#r   )r+   r,   s   ` r   	decorator.redirect_if_add_not_allowed.<locals>.decorator   s"    	y			7 
		7 r    )functionr.   s     r   redirect_if_add_not_allowedr2      s     ""r   )N)	functoolsr   django.contribr   django.contrib.auth.base_userr   django.core.exceptionsr   django.httpr   django.urlsr	   allauth.account.adapterr
   r#   allauth.account.modelsr   allauth.mfar   allauth.mfa.adapterr   r2   r0   r   r   <module>r=      s?     # : 2 ,  F / $ +A)9 Ad Ar   