o
    ˷e(
                     @   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)selfdflt	__class__ n/var/www/ideatree/venv/lib/python3.10/site-packages/allauth/socialaccount/providers/amazon_cognito/provider.pyr	   
   s   zAmazonCognitoAccount.to_strc                 C      | j jdS )Npicturer
   r   r   r   r   r   r   get_avatar_url      z#AmazonCognitoAccount.get_avatar_urlc                 C   r   )Nprofiler   r   r   r   r   get_profile_url   r   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 )AmazonCognitoProvider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email
given_namefamily_name)r&   
first_name	last_name)r   r#   r   r   r   extract_common_fields   s   z+AmazonCognitoProvider.extract_common_fieldsc                 C   s   g dS )N)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&   email_verifiedFT)r&   verified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)r2   r3   r4   r5   r6   r7   r8   r9   r   r:   r   r;   r<   )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   r@   G   s   zAmazonCognitoProvider.get_slug)r   r   r   idnamer   account_classr%   r+   r-   r1   r=   classmethodr@   r   r   r   r   r   r      s    r   N)allauth.account.modelsr   4allauth.socialaccount.providers.amazon_cognito.utilsr   $allauth.socialaccount.providers.baser   /allauth.socialaccount.providers.oauth2.providerr   r   r   provider_classesr   r   r   r   <module>   s    
8