o
    "4g                     @   s   d dl mZ d dlmZmZ d dl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ededefddZdededdfddZdedefddZdddddddZdS )    )messages)HttpRequestHttpResponse)reverse)app_settingssignals)get_adapter)email_verification_by_code)perform_login)Login)get_frontend_url)build_absolute_urirequestemailreturnc              	   C   sR   t | }|| || tjd|ddd tjr!tj| d |d |	| d }|S )Nz,account/messages/email_confirmation_sent.txtFT)r   loginsignup)userr   )
r    send_account_already_exists_mailadd_messager   INFOr   "EMAIL_VERIFICATION_BY_CODE_ENABLEDr	   request_email_verification_coderespond_email_verification_sent)r   r   adapterresp r   n/var/www/html/authentication-server/venv/lib/python3.10/site-packages/allauth/account/internal/flows/signup.pyprevent_enumeration   s   

r   Nc                 C   s0   t jsd S t| }| |d}t d|| d S )N)r   
signup_urlzaccount/email/unknown_account)r   EMAIL_UNKNOWN_ACCOUNTSget_signup_urlr   	send_mail)r   r   r   contextr   r   r   send_unknown_account_mail   s   r$   c                 C   s    t | d}|st| td}|S )Naccount_signup)r   r   r   )r   urlr   r   r   r!   *   s   
r!   F)email_verificationredirect_urlsignal_kwargs
by_passkeyc                C   sR   |d u ri }t jjd|j| |d| t||||dd}|r$d|jd< t| |S )N)senderr   r   T)r   r'   r(   r)   r   passkey_signupr   )r   user_signed_upsend	__class__r   stater
   )r   r   r'   r(   r)   r*   r   r   r   r   complete_signup1   s"   	

r1   )django.contribr   django.httpr   r   django.urlsr   allauth.accountr   r   allauth.account.adapterr   allauth.account.internal.flowsr	   $allauth.account.internal.flows.loginr
   allauth.account.modelsr   allauth.core.internal.httpkitr   allauth.utilsr   strr   r$   r!   r1   r   r   r   r   <module>   s$    