o
    ˷e                     @   sL   d dl Z d dlZd dlZd dlmZ d dlmZmZ ddlm	Z	 dd Z
dS )    N)	providers)complete_social_loginrender_authentication_error   )TelegramProviderc           
      C   s   t jtj| }t| j }|d}d	t
dd | D }| d }t|  }t|| tj }t|d}||ksPt | dkrZt| |jd|id	S || |}	t| |	S )
Nhash
c                 S   s   g | ]
\}}d  ||qS )z{}={})format).0kv r   e/var/www/ideatree/venv/lib/python3.10/site-packages/allauth/socialaccount/providers/telegram/views.py
<listcomp>   s    z"telegram_login.<locals>.<listcomp>TOKEN	auth_date   response)provider_idextra_context)r   registryby_idr   iddictGETitemspopjoinsortedget_settingshashlibsha256encodedigesthmacnew	hexdigestinttimer   sociallogin_from_responser   )
requestproviderdatar   payloadtokentoken_sha256expected_hashr   loginr   r   r   telegram_login   s   

r2   )r    r$   r(   allauth.socialaccountr   allauth.socialaccount.helpersr   r   r+   r   r2   r   r   r   r   <module>   s    