o
    &zh                     @   s   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 d d	lmZ d
eeee f fddZded
dfddZdS )    )OptionalTuple)messages)get_adapter)"raise_if_reauthentication_required)signals)delete_and_cleanup)Authenticator)auto_generate_recovery_codes)TOTPreturnc                 C   sf   t |  t| j|jj}tjjt	| | j|d t
| }|| tjd |d| j t| }||fS )N)senderrequestuserauthenticatorzmfa/messages/totp_activated.txtzmfa/email/totp_activated)r   r   activater   secretinstancer   authenticator_addedsendr	   get_account_adapteradd_messager   SUCCESSsend_notification_mailr
   )r   form	totp_authadapterrc_auth r   Z/var/www/html/kangema/venv/lib/python3.10/site-packages/allauth/mfa/totp/internal/flows.pyactivate_totp   s   r    r   Nc                 C   s<   t |  t| | t| }|| tjd |d| j d S )Nz!mfa/messages/totp_deactivated.txtzmfa/email/totp_deactivated)r   r   r   r   r   r   r   r   )r   r   r   r   r   r   deactivate_totp    s
   
r!   )typingr   r   django.contribr   allauth.account.adapterr   r   /allauth.account.internal.flows.reauthenticationr   allauth.mfar   allauth.mfa.base.internal.flowsr   allauth.mfa.modelsr	   )allauth.mfa.recovery_codes.internal.flowsr
   allauth.mfa.totp.internal.authr   r    r!   r   r   r   r   <module>   s    