
    fc                     8   d dl Z d dlmZmZmZ d dlmZ d dlmZm	Z	 d dl
mZmZ 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
lmZ d dlmZmZ d dlmZ dZdeddfdZdede de!de	fdZ"dede!de	fdZ#dedee	   fdZ$deddfdZ%dede&fdZ'dee   fdZ(y)    N)DictListOptional)REDIRECT_FIELD_NAME)HttpRequestHttpResponseRedirect)resolvereverse)	urlencode)app_settings)get_authentication_recordsrecord_authentication)ReauthenticationRequired)deserialize_requestserialize_request)import_callableaccount_reauthentication_staterequestreturnc                      t        | dd       y )NpasswordT)methodreauthenticatedr   r   s    j/var/www/cs2snipe.com/venv/lib/python3.12/site-packages/allauth/account/internal/flows/reauthentication.pyreauthenticate_by_passwordr      s    '*dK    statecallbackc                 V    ||d| j                   t        <   t        t        d            S )N)r   r    account_reauthenticate)sessionSTATE_SESSION_KEYr   r
   )r   r   r    s      r   stash_and_reauthenticater%      s.     *GOO%&  (@ ABBr   redirect_toc                     | j                         }| j                  dk(  rdt        |       i| j                  t        <   t        |dz   t        t        |i      z         S )NPOSTr   ?)get_full_pathr   r   r#   r$   r   r   r   )r   r&   paths      r   suspend_requestr,   &   s[      "D~~.79J79S-T)*cI':D&ABB r   c                    ddl m} | j                  j                  t        d       }|rd|v rt        |d         } || |d         S  || t              }|sy |rad|v r]t        |d   |       }|j                  |k(  r?t        |j                        } |j                  |g|j                  i |j                  S t        |      S )Nr   )get_next_redirect_urlr    r   r   )allauth.account.utilsr.   r#   popr$   r   r   r   r+   r	   funcargskwargsr   )r   r.   r   r    urlsuspended_requestresolveds          r   resume_requestr7   /   s    ;OO 148Eu$"5#45w00
)<
=Ce#/i0@'J!!S(0556H 8==!2VX]]VhooVV$$r   c                 .    t        |       s
t               y )N)did_recently_authenticater   r   s    r   "raise_if_reauthentication_requiredr:   B   s    $W-&(( .r   c                     | j                   j                  ryt        | j                         syt        |       }|sy|d   d   }t	        j                         |z
  t
        j                  k  S )NFTat)useris_anonymousget_reauthentication_flowsr   timer   REAUTHENTICATION_TIMEOUT)r   methodsauthenticated_ats      r   r9   r9   G   s_    ||  %gll3 (1Gr{4(99;))L,Q,QQQr   c                 4   g }| j                   s|S | j                         rddi}|j                  |       t        j                  rRddlm} ddlm} g }|j                  D ]  } || |g      s|j                  |       ! |r|j                  d|d       |S )	Nidreauthenticater   )Authenticator)is_mfa_enabled)typesmfa_reauthenticate)rF   rJ   )
is_authenticatedhas_usable_passwordappendallauth_settingsMFA_ENABLEDallauth.mfa.modelsrH   allauth.mfa.utilsrI   Type)r>   retentryrH   rI   rJ   typs          r   r@   r@   Y   s    C  
!"
 	

5##44 %% 	"Cd3%0S!	" JJ2UCDJr   ))rA   typingr   r   r   django.contrib.authr   django.httpr   r   django.urlsr	   r
   django.utils.httpr   allauthr   rO   allauth.accountallauth.account.authenticationr   $allauth.account.internal.flows.loginr   allauth.core.exceptionsr   allauth.core.internal.httpkitr   r   allauth.utilsr   r$   r   dictstrr%   r,   r7   r:   boolr9   r@    r   r   <module>rg      s     ' ' 3 9 ( ' 4 ( E F < * 5 L L LCC!%C14CC[ s ?S %K %H5I,J %&) ) )
R{ Rt R$T
 r   