o
    ˷e                     @   sn   d dl mZ d dlmZ d dlmZmZ d dlmZ G dd de	Z
G dd deZG d	d
 d
eZegZdS )    )EmailAddress)QUERY_EMAIL)
AuthActionProviderAccount)OAuth2Providerc                   @   s   e Zd ZdZdZdS )ScopeemailprofileN)__name__
__module____qualname__EMAILPROFILE r   r   f/var/www/ideatree/venv/lib/python3.10/site-packages/allauth/socialaccount/providers/google/provider.pyr      s    r   c                       s,   e Zd Zdd Zdd Z fddZ  ZS )GoogleAccountc                 C      | j jdS )Nlinkaccount
extra_datagetselfr   r   r   get_profile_url      zGoogleAccount.get_profile_urlc                 C   r   )Npicturer   r   r   r   r   get_avatar_url   r   zGoogleAccount.get_avatar_urlc                    s   t t|  }| jjd|S )Nname)superr   to_strr   r   r   )r   dflt	__class__r   r   r       s   zGoogleAccount.to_str)r
   r   r   r   r   r    __classcell__r   r   r"   r   r      s    r   c                       sH   e Zd ZdZdZeZdd Z fddZdd Z	d	d
 Z
dd Z  ZS )GoogleProvidergoogleGooglec                 C   s   t jg}tr|t j |S )N)r   r   r   appendr   )r   scoper   r   r   get_default_scope   s   z GoogleProvider.get_default_scopec                    s(   t t| ||}|tjkrd|d< |S )Nzselect_account consentprompt)r   r%   get_auth_paramsr   REAUTHENTICATE)r   requestactionretr"   r   r   r,   #   s   
zGoogleProvider.get_auth_paramsc                 C   s   t |d S )Nid)strr   datar   r   r   extract_uid)   s   zGoogleProvider.extract_uidc                 C   s    t |d|d|ddS )Nr   family_name
given_name)r   	last_name
first_name)dictr   r3   r   r   r   extract_common_fields,   s
   z$GoogleProvider.extract_common_fieldsc                 C   s4   g }| d}|r| dr|t|ddd |S )Nr   verified_emailT)r   verifiedprimary)r   r(   r   )r   r4   r0   r   r   r   r   extract_email_addresses3   s
   
z&GoogleProvider.extract_email_addresses)r
   r   r   r1   r   r   account_classr*   r,   r5   r;   r?   r$   r   r   r"   r   r%      s    r%   N)allauth.account.modelsr   "allauth.socialaccount.app_settingsr   $allauth.socialaccount.providers.baser   r   /allauth.socialaccount.providers.oauth2.providerr   objectr   r   r%   provider_classesr   r   r   r   <module>   s    
#