a
    Qx_(
                     @   sZ   d dl mZ d dlmZ d dlmZ d dlmZ G dd deZG dd deZ	e	gZ
d	S )
    )EmailAddress)3convert_to_python_bool_if_value_is_json_string_bool)ProviderAccount)OAuth2Providerc                       s,   e Zd Z fddZdd Zdd Z  ZS )AmazonCognitoAccountc                    s   t t|  }| jjd|S )Nusername)superr   to_straccount
extra_dataget)selfZdflt	__class__ o/var/www/html/Ranjet/env/lib/python3.9/site-packages/allauth/socialaccount/providers/amazon_cognito/provider.pyr	   
   s    zAmazonCognitoAccount.to_strc                 C   s   | j jdS )Npicturer
   r   r   r   r   r   r   get_avatar_url   s    z#AmazonCognitoAccount.get_avatar_urlc                 C   s   | j jdS )Nprofiler   r   r   r   r   get_profile_url   s    z$AmazonCognitoAccount.get_profile_url)__name__
__module____qualname__r	   r   r   __classcell__r   r   r   r   r   	   s   r   c                       sT   e Zd ZdZdZeZdd Zdd Zdd Z	d	d
 Z
dd Ze fddZ  ZS )AmazonCognitoProviderZamazon_cognitozAmazon Cognitoc                 C   s   t |d S )Nsub)strr   datar   r   r   extract_uid   s    z!AmazonCognitoProvider.extract_uidc                 C   s   | d| d| ddS )NemailZ
given_nameZfamily_name)r"   Z
first_name	last_name)r   r   r   r   r   extract_common_fields   s    z+AmazonCognitoProvider.extract_common_fieldsc                 C   s   g dS )N)Zopenidr   r"   r   r   r   r   r   get_default_scope%   s    z'AmazonCognitoProvider.get_default_scopec                 C   s2   | d}t| dd}|r.t||ddgS g S )Nr"   Zemail_verifiedFT)r"   verifiedZprimary)r   r   r   )r   r    r"   r&   r   r   r   extract_email_addresses(   s    

z-AmazonCognitoProvider.extract_email_addressesc                 C   sr   | d| d| d| d| d| d| dt| d| d	| d
| d| d| ddS )Naddress	birthdategenderlocale
middlenamenicknamephone_numberphone_number_verifiedr   preferred_usernamer   websitezoneinfo)r(   r)   r*   r+   r,   r-   r.   r/   r   r0   r   r1   r2   )r   r   r   r   r   r   extract_extra_data4   s     z(AmazonCognitoProvider.extract_extra_datac                    s   t t|  ddS )N_-)r   r   get_slugreplace)clsr   r   r   r6   G   s    zAmazonCognitoProvider.get_slug)r   r   r   idnamer   Zaccount_classr!   r$   r%   r'   r3   classmethodr6   r   r   r   r   r   r      s   r   N)Zallauth.account.modelsr   Z4allauth.socialaccount.providers.amazon_cognito.utilsr   Z$allauth.socialaccount.providers.baser   Z/allauth.socialaccount.providers.oauth2.providerr   r   r   Zprovider_classesr   r   r   r   <module>   s   8