o
    š"4g1  ã                   @   sx   d dl mZmZ d dlmZ d dlmZ d dlmZm	Z	 d dl
mZ d dlmZ d dlmZ G dd	„ d	eƒZd
d„ ZdS )é    )ÚAnyÚDict)ÚField)ÚEmailAddress)Úuser_displayÚuser_username)ÚBaseAdapter)Úapp_settings)Úimport_attributec                
   @   sD   e Zd ZdZddddddejd d	d
dœ	Zdeee	f fdd„Z
dS )ÚDefaultHeadlessAdapteraB  The adapter class allows you to override various functionality of the
    ``allauth.headless`` app.  To do so, point ``settings.HEADLESS_ADAPTER`` to your own
    class that derives from ``DefaultHeadlessAdapter`` and override the behavior by
    altering the implementation of the methods according to your own need.
    zUnknown account.z`client_id` required.z-Pass only one of email or username, not both.zInvalid token.z/Provider does not support token authentication.z*`id_token` and/or `access_token` required.ÚrequiredzUnknown email address.zInvalid URL.)	Úaccount_not_foundÚclient_id_requiredÚemail_or_usernameÚinvalid_tokenÚ"token_authentication_not_supportedÚtoken_requiredr   Úunknown_emailÚinvalid_urlÚreturnc                 C   sF   |j t|ƒ| ¡ dœ}tj |¡}|r||d< t|ƒ}|r!||d< |S )z°
        Returns the basic user data. Note that this data is also exposed in
        partly authenticated scenario's (e.g. password reset, email
        verification).
        )ÚidÚdisplayÚhas_usable_passwordÚemailÚusername)Úpkr   r   r   ÚobjectsÚget_primary_emailr   )ÚselfÚuserÚretr   r   © r!   úa/var/www/html/authentication-server/venv/lib/python3.10/site-packages/allauth/headless/adapter.pyÚserialize_user!   s   ýz%DefaultHeadlessAdapter.serialize_userN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   Údefault_error_messagesÚerror_messagesr   Ústrr   r#   r!   r!   r!   r"   r      s    	õr   c                   C   s   t tjƒƒ S )N)r
   r	   ÚADAPTERr!   r!   r!   r"   Úget_adapter5   s   r,   N)Útypingr   r   Údjango.forms.fieldsr   Úallauth.account.modelsr   Úallauth.account.utilsr   r   Úallauth.core.internal.adapterr   Úallauth.headlessr	   Úallauth.utilsr
   r   r,   r!   r!   r!   r"   Ú<module>   s    )