ó
    TÑšh 9  ã                   óÔ   • S SK r S SKrS SKJrJr  S SKJr  S SKJr  S SK	J
r
  S SKJr  S SKJr  S SKJr  S S	KJrJrJr  S S
KJr  S SKJrJr  S SKJr  SSKJr   " S S\5      r SS jrg)é    N)ÚImproperlyConfiguredÚMultipleObjectsReturned)ÚQ©Úreverse)Úget_random_string)Úgettext_lazy)Úget_adapter)Úvalid_email_or_none)Ú
user_emailÚ
user_fieldÚuser_username)ÚBaseAdapter)Údeserialize_instanceÚserialize_instance)Úimport_attributeé   )Úapp_settingsc                   ó  • \ rS rSrSr\" S5      \" S5      \" S5      \" S5      \" S5      \" S5      S	.rS
 r   S#S jrS r	S$S jr
S rS rS%S jrS rS rS rS rS rS rS$S jrS&S jrS$S jrS rS rS rS rS \S\4S! jrS"rg)'ÚDefaultSocialAccountAdapteré   aB  The adapter class allows you to override various functionality of the
``allauth.socialaccount`` app.  To do so, point ``settings.SOCIALACCOUNT_ADAPTER`` to
your own class that derives from ``DefaultSocialAccountAdapter`` and override the
behavior by altering the implementation of the methods according to your own
needs.
zvAn account already exists with this email address. Please sign in to that account first, then connect your %s account.zInvalid token.z$Your account has no password set up.z+Your account has no verified email address.z>You cannot disconnect your last remaining third-party account.zDThe third-party account is already connected to a different account.)Úemail_takenÚinvalid_tokenÚno_passwordÚno_verified_emailÚdisconnect_lastÚconnected_otherc                 ó   • g)aÁ  
Invoked just after a user successfully authenticates via a
social provider, but before the login is actually processed
(and before the pre_social_login signal is emitted).

You can use this hook to intervene, e.g. abort the login by
raising an ImmediateHttpResponse

Why both an adapter hook and the signal? Intervening in
e.g. the flow from within a signal handler is bad -- multiple
handlers may be active and are executed in undetermined order.
N© ©ÚselfÚrequestÚsociallogins      ÚXD:\Anime\Ugyen\janka_web_project\venv\Lib\site-packages\allauth/socialaccount/adapter.pyÚpre_social_loginÚ,DefaultSocialAccountAdapter.pre_social_login-   s   € ð 	ó    Nc                 óŽ   • [        U S5      (       a4  [        R                  " S5        U R                  UUR                  UUUS9  gg)zà
Invoked when there is an error in the authentication cycle. In this
case, pre_social_login will not be reached.

You can use this hook to intervene, e.g. redirect to an
educational flow by raising an ImmediateHttpResponse.
Úauthentication_errorzSadapter.authentication_error() is deprecated, use adapter.on_authentication_error())ÚerrorÚ	exceptionÚextra_contextN)ÚhasattrÚwarningsÚwarnr)   Úid)r!   r"   Úproviderr*   r+   r,   s         r$   Úon_authentication_errorÚ3DefaultSocialAccountAdapter.on_authentication_error<   sN   € ô 4Ð/×0Ñ0ÜMŠMØeôð ×%Ñ%ØØ—‘ØØ#Ø+ð &ò ð 1r'   c                 ó4   • [        5       R                  U5      $ )z#
Instantiates a new User instance.
)Úget_account_adapterÚnew_userr    s      r$   r6   Ú$DefaultSocialAccountAdapter.new_userX   s   € ô #Ó$×-Ñ-¨gÓ6Ð6r'   c                 óÊ   • UR                   nUR                  5         [        5       nU(       a  UR                  XU5        OUR	                  X5        UR                  U5        U$ )za
Saves a newly signed up social login. In case of auto-signup,
the signup form is not available.
)ÚuserÚset_unusable_passwordr5   Ú	save_userÚpopulate_usernameÚsave)r!   r"   r#   ÚformÚuÚaccount_adapters         r$   r;   Ú%DefaultSocialAccountAdapter.save_user^   sW   € ð
 ×ÑˆØ	×ÑÔ!Ü-Ó/ˆÞØ×%Ñ% g°$Õ7à×-Ñ-¨gÔ9Ø×Ñ˜Ô!Øˆr'   c                 óÄ  • UR                  S5      nUR                  S5      nUR                  S5      nUR                  S5      nUR                  S5      nUR                  n	[        X”=(       d    S5        [        U	[	        U5      =(       d    S5        U=(       d    SR                  S5      n
[        U	SU=(       d    U
S   5        [        U	SU=(       d    U
S	   5        U	$ )
a¯  
Hook that can be used to further populate the user instance.

For convenience, we populate several common fields.

Note that the user instance being populated represents a
suggested User instance that represents the social user that is
in the process of being logged in.

The User instance need not be completely valid and conflict
free. For example, verifying whether or not the username
already exists, is not a responsibility.
ÚusernameÚ
first_nameÚ	last_nameÚemailÚnameÚ Ú r   é   )Úgetr9   r   r   r   Ú	partitionr   )r!   r"   r#   ÚdatarC   rD   rE   rF   rG   r9   Ú
name_partss              r$   Úpopulate_userÚ)DefaultSocialAccountAdapter.populate_userm   s¹   € ð —8‘8˜JÓ'ˆØ—X‘X˜lÓ+ˆ
Ø—H‘H˜[Ó)ˆ	Ø—‘˜Ó!ˆØx‰x˜ÓˆØ×ÑˆÜdŸN¨Ô+Ü4Ô,¨UÓ3×9°rÔ:Ø—j˜b×+Ñ+¨CÓ0ˆ
Ü4˜ z×'B°ZÀ±]ÔCÜ4˜ i×&@°:¸a±=ÔAØˆr'   c                 ó   • [        S5      nU$ )zX
Returns the default URL to redirect to after successfully
connecting a social account.
Úsocialaccount_connectionsr   )r!   r"   ÚsocialaccountÚurls       r$   Úget_connect_redirect_urlÚ4DefaultSocialAccountAdapter.get_connect_redirect_urlˆ   s   € ô
 Ð1Ó2ˆØˆ
r'   Úreturnc                 ó   • g)zO
Validate whether or not the socialaccount account can be
safely disconnected.
Nr   )r!   ÚaccountÚaccountss      r$   Úvalidate_disconnectÚ/DefaultSocialAccountAdapter.validate_disconnect   s   € ð
 	r'   c                 ó&   • [         R                  nU$ ©N)r   ÚAUTO_SIGNUP)r!   r"   r#   Úauto_signups       r$   Úis_auto_signup_allowedÚ2DefaultSocialAccountAdapter.is_auto_signup_allowed—   s   € ä"×.Ñ.ˆØÐr'   c                 ó6   • [        U5      R                  U5      $ )z¦
Checks whether or not the site is open for signups.

Next to simply returning True/False you can also intervene the
regular flow by raising an ImmediateHttpResponse
)r5   Úis_open_for_signupr    s      r$   rd   Ú.DefaultSocialAccountAdapter.is_open_for_signupœ   s   € ô # 7Ó+×>Ñ>¸wÓGÐGr'   c                 ó6  • UR                   n[        U5      nU(       d2  [        UR                  5      S:”  a  UR                  S   R                  nU=(       d    S[        U5      =(       d    S[        US5      =(       d    S[        US5      =(       d    SS.nU$ )Nr   rH   rD   rE   )rF   rC   rD   rE   )r9   r   ÚlenÚemail_addressesrF   r   r   )r!   r#   r9   rF   Úinitials        r$   Úget_signup_form_initial_dataÚ8DefaultSocialAccountAdapter.get_signup_form_initial_data¥   s‚   € Ø×ÑˆÜ˜4Ó ˆÞœ˜[×8Ñ8Ó9¸AÓ=Ø×/Ñ/°Ñ2×8Ñ8ˆEà—[˜bÜ% dÓ+×1¨rÜ$ T¨<Ó8×>¸BÜ# D¨+Ó6×<¸"ñ	
ˆð ˆr'   c                 ó   • [        X5      $ r^   )r   )r!   ÚmodelrM   s      r$   r   Ú0DefaultSocialAccountAdapter.deserialize_instance²   s   € Ü# EÓ0Ð0r'   c                 ó   • [        U5      $ r^   )r   )r!   Úinstances     r$   r   Ú.DefaultSocialAccountAdapter.serialize_instanceµ   s   € Ü! (Ó+Ð+r'   c                 óˆ  • SSK Jn  / nUR                  5       nU R                  U5      n0 nU H.  nUR	                  UR
                  / 5      R                  U5        M0     U H\  nUR                  UR                  / 5      n	U	(       d  UR                  (       a  M9  S /n	U	 H  nU" XS9n
UR                  U
5        M     M^     U$ )Nr   ©Úregistry)r"   Úapp)
Úallauth.socialaccount.providersrt   Úget_class_listÚ	list_appsÚ
setdefaultr1   ÚappendrK   r0   Ú	uses_apps)r!   r"   rt   ÚretÚprovider_classesÚappsÚapps_mapru   Úprovider_classÚprovider_appsr1   s              r$   Úlist_providersÚ*DefaultSocialAccountAdapter.list_providers¸   s²   € Ý<àˆØ#×2Ñ2Ó4ÐØ~‰~˜gÓ&ˆØˆÛˆCØ×Ñ §¡¨bÓ1×8Ñ8¸Ö=ñ ã.ˆNØ$ŸL™L¨×):Ñ):¸BÓ?ˆMÞ Ø!×+×+ÙØ!% Û$Ù)°'ÑCØ—
‘
˜8Ö$ó %ñ /ð ˆ
r'   c                 ód  • SSK Jn  UR                  U5      nUb  UR                  (       aW  U R	                  XUS9nU(       d  UR                  UR
                  5      nU(       d  [        SUR
                   35      eU" XS9$ U(       a  UR                  (       a   eU" USS9$ [        SU 35      e)zOLooks up a `provider`, supporting subproviders by looking up by
`provider_id`.
r   rs   N©r1   Ú	client_idzunknown provider: )ru   )rv   rt   Ú	get_classr{   Úget_appr1   r   )r!   r"   r1   r†   rt   r€   ru   s          r$   Úget_providerÚ(DefaultSocialAccountAdapter.get_providerÌ   s§   € õ 	=à!×+Ñ+¨HÓ5ˆØÑ! ^×%=×%=Ø—,‘,˜wÀY,ÐOˆCÞ!ð "*×!3Ñ!3°C·L±LÓ!AÞ!Ü*Ð-?ÀÇÁ¸~Ð+NÓOÐOÙ! 'Ñ3Ð3ÞØ%×/×/Ð/Ð/Ù! '¨tÑ4Ð4ä&Ð);¸H¸:Ð'FÓGÐGr'   c           	      óö  • SSK Jn  0 nU(       a  UR                  R                  U5      nOUR                  R	                  5       nU(       a"  UR                  [        US9[        US9-  5      nU(       a  UR                  US9nU H0  nUR                  UR                  / 5      nUR                  U5        M2     [        R                  R                  5        Hò  u  pšU
R                  S5      nUc  U
R                  S5      nUc  M/  U/nUR                  U	/ 5      nU H¨  nU" U	S9nS H  nXí;   d  M
  [        X~XÞ   5        M     S	U;   a(  [        R                   " S
5        US	   UR"                  S	'   U(       a  UR$                  U:w  a  Mn  U(       a"  UR&                  U:w  a  UR                  U:w  a  M—  UR                  U5        Mª     Mô     / nUR)                  5        H  nUR+                  U5        M     U$ )zÝSocialApp's can be setup in the database, or, via
`settings.SOCIALACCOUNT_PROVIDERS`.  This methods returns a uniform list
of all known apps matching the specified criteria, and blends both
(db/settings) sources of data.
r   ©Ú	SocialApp)r1   )Úprovider_id)r†   ÚAPPSÚAPP)rG   rŽ   r†   ÚsecretÚkeyÚsettingsÚcertificate_keyz3'certificate_key' should be moved into app.settings)Úallauth.socialaccount.modelsr   ÚobjectsÚon_siteÚallÚfilterr   ry   r1   rz   r   Ú	PROVIDERSÚitemsrK   Úsetattrr.   r/   r“   r†   rŽ   ÚvaluesÚextend)r!   r"   r1   r†   r   Úprovider_to_appsÚdb_appsru   r~   ÚpÚpcfgÚapp_configsÚ
app_configÚconfigÚfieldr   s                   r$   rx   Ú%DefaultSocialAccountAdapter.list_appsâ   sÃ  € õ 	;ð Ðö Ø×'Ñ'×/Ñ/°Ó8‰Gà×'Ñ'×+Ñ+Ó-ˆGÞØ—n‘n¤Q°Ñ%9¼AÈ(Ñ<SÑ%SÓTˆGÞØ—n‘n¨ynÐ9ˆGÛˆCØ#×.Ñ.¨s¯|©|¸RÓ@ˆDØK‰K˜Öñ ô
 $×-Ñ-×3Ñ3Ö5‰GˆAØŸ(™( 6Ó*ˆKØÑ"Ø!ŸX™X e›_
ØÑ%ÙØ)˜là#×.Ñ.¨q°"Ó5ˆDÛ%Ù¨Ñ+óEð •Ü ¨F©MÖ:ñð %¨Ó.Ü—M’MÐ"WÔXØ6<Ð=NÑ6OC—L‘LÐ!2Ñ3Þ §¡°)Ó!;ÙæØŸ™¨8Ó3ØŸ™¨Ó0áØ—‘˜CÖ ó/ &ñ 6ðF ˆØ-×4Ñ4Ö6ˆMØK‰K˜Ö&ñ 7àˆr'   c                 ó<  • SSK Jn  U R                  XUS9n[        U5      S:”  aO  U Vs/ s H&  ofR                  R                  S5      (       a  M$  UPM(     nn[        U5      S:w  a  [        eUnUS   $ [        U5      S:X  a  UR                  5       eUS   $ s  snf )Nr   rŒ   r…   r   Úhidden)r•   r   rx   rg   r“   rK   r   ÚDoesNotExist)r!   r"   r1   r†   r   r~   ru   Úvisible_appss           r$   rˆ   Ú#DefaultSocialAccountAdapter.get_app$  s“   € Ý:à~‰~˜gÀIˆ~ÐNˆÜˆt‹9q‹=Ù+/ÓRª4 C·|±|×7GÑ7GÈ×7QŸC©4ˆLÐRÜ<Ó  AÓ%Ü-Ð-ØˆDð A‰wˆô ‹Y˜!‹^Ø×(Ñ(Ó*Ð*ØA‰wˆùò Ss   ª#BÁBc                 ó6   • [        5       R                  " U0 UD6$ r^   )r5   Úsend_notification_mail)r!   ÚargsÚkwargss      r$   r®   Ú2DefaultSocialAccountAdapter.send_notification_mail1  s   € Ü"Ó$×;Ò;¸TÐLÀVÑLÐLr'   c                 ó’   • SS K nUR                  5       n[        R                  " UR                  [
        R                  S9Ul        U$ )Nr   )Útimeout)ÚrequestsÚSessionÚ	functoolsÚpartialr"   r   ÚREQUESTS_TIMEOUT)r!   r´   Úsessions      r$   Úget_requests_sessionÚ0DefaultSocialAccountAdapter.get_requests_session4  s;   € Ûà×"Ñ"Ó$ˆÜ#×+Ò+ØO‰O¤\×%BÑ%Bñ
ˆŒð ˆr'   c                 óÄ  • SnUR                   (       a%  UR                   R                  R                  S5      nUc"  UR                  5       nUR                  SS5      n[	        U[
        5      (       a   U$ [	        U[        5      (       aG  UR                  S5      S   R                  5       nU Vs/ s H  ofR                  5       PM     nnXW;   nU$ [        S5      es  snf )aŒ  
Returns ``True`` iff the given email encountered during a social
login for the given provider is to be assumed verified.

This can be configured with a ``"verified_email"`` key in the provider
app settings, or a ``"VERIFIED_EMAIL"`` in the global provider settings
(``SOCIALACCOUNT_PROVIDERS``).  Both can be set to ``False`` or
``True``, or, a list of domains to match email addresses against.
NÚverified_emailÚVERIFIED_EMAILFÚ@rJ   z!verified_email wrongly configured)
ru   r“   rK   Úget_settingsÚ
isinstanceÚboolÚlistrL   Úlowerr   )r!   r1   rF   r½   r“   Úemail_domainÚdÚverified_domainss           r$   Úis_email_verifiedÚ-DefaultSocialAccountAdapter.is_email_verified=  sÐ   € ð ˆØ<<Ø%Ÿ\™\×2Ñ2×6Ñ6Ð7GÓHˆNØÑ!Ø×,Ñ,Ó.ˆHØ%Ÿ\™\Ð*:¸EÓBˆNÜn¤d×+Ñ+Øð Ðô ˜¬×-Ñ-Ø Ÿ?™?¨3Ó/°Ñ2×8Ñ8Ó:ˆLÙ3AÓB²>¨a§¡¦	±>ÐÐBØ)Ñ=ˆNð Ðô 'Ð'JÓKÐKùò  Cs   Â1Cc                 ó  • SnUR                   nUR                  (       a%  UR                  R                  R                  S5      nUc7  [        R
                  =(       d     UR                  5       R                  SS5      nU$ )a  
Returns ``True`` iff  authentication by email is active for this login/email.

This can be configured with a ``"email_authentication"`` key in the provider
app settings, or a ``"VERIFIED_EMAIL"`` in the global provider settings
(``SOCIALACCOUNT_PROVIDERS``).
NÚemail_authenticationÚEMAIL_AUTHENTICATIONF)r1   ru   r“   rK   r   rÌ   rÀ   )r!   ÚloginrF   r|   r1   s        r$   Úcan_authenticate_by_emailÚ5DefaultSocialAccountAdapter.can_authenticate_by_emailW  sk   € ð ˆØ—>‘>ˆØ<<Ø—,‘,×'Ñ'×+Ñ+Ð,BÓCˆCØ‰;Ü×3Ñ3÷ °x×7LÑ7LÓ7N×7RÑ7RØ&¨ó8ˆCð ˆ
r'   Ústatec                 ó$   • SSK Jn  [        U5      $ )a†  
To preserve certain state before the handshake with the provider
takes place, and be able to verify/use that state later on, a `state`
parameter is typically passed to the provider. By default, a random
string sufficies as the state parameter value is actually just a
reference/pointer to the actual state. You can use this adapter method
to alter the generation of the `state` parameter.
r   )ÚSTATE_ID_LENGTH)Ú'allauth.socialaccount.internal.statekitrÒ   r   )r!   rÐ   rÒ   s      r$   Úgenerate_state_paramÚ0DefaultSocialAccountAdapter.generate_state_parami  s   € õ 	Lä  Ó1Ð1r'   r   )NNNr^   )rW   N)NN)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__Ú_Úerror_messagesr%   r2   r6   r;   rO   rU   r[   ra   rd   rj   r   r   r‚   r‰   rx   rˆ   r®   rº   rÈ   rÎ   ÚdictÚstrrÔ   Ú__static_attributes__r   r'   r$   r   r      sÙ   † ññ ð ó
ñ
 Ð+Ó,ÙÐ?Ó@ÙÐLÓMÙØLó
ñ ØRó
ñ€Nò"ð& ØØôò87ôòò6ôòò
Hòò1ò,òô(Hô,@ôDòMòòò4ð$2¨$ð 2°3÷ 2r'   r   c                 ó@   • [        [        R                  5      " U 5      $ r^   )r   r   ÚADAPTER)r"   s    r$   r
   r
   w  s   € ÜœL×0Ñ0Ô1°'Ó:Ð:r'   r^   )!r¶   r.   Údjango.core.exceptionsr   r   Údjango.db.modelsr   Údjango.urlsr   Údjango.utils.cryptor   Údjango.utils.translationr	   rÛ   Úallauth.account.adapterr
   r5   Ú!allauth.account.internal.emailkitr   Úallauth.account.utilsr   r   r   Úallauth.core.internal.adapterr   Úallauth.core.internal.modelkitr   r   Úallauth.utilsr   rH   r   r   r   r'   r$   Ú<module>rí      sF   ðÛ Û ç PÝ Ý Ý 1Ý 6å FÝ Aß GÑ GÝ 5ß SÝ *å ô`2 +ô `2õF;r'   