U
    `/                     @   sf  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 d dlmZ d dlmZ d d	lmZ d d
lmZ d dlmZ d dlmZmZmZmZ d dlmZmZ d dl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%G dd deZ&G dd deZ'G dd deZ(edgdd Z)G d d! d!eZ*eed"gd#d$ Z+e ed%ed&ed'ee"ed(e
, d)d*ed+e
, d,d*ed-e$, d.d*ed/e%, d0d*ed1e)d2d*ed3e*, d4d*ed5e&, d6d*ed7e', d8d*ed9e, d:d*ed;e#, ed<e, d=d*ed>ed?ed@e+dAd*edBe, dCd*edDe , dEd*g7 Z dFS )G    )FacebookOAuth2Adapter)TwitterOAuthAdapter)includeurl)ensure_csrf_cookie)TemplateView)permissions)api_viewResponse)APIView)TokenVerifyView)get_refresh_view)SocialAccountDisconnectViewSocialAccountListViewSocialConnectViewSocialLoginView)TwitterConnectSerializerTwitterLoginSerializer)urlpatterns   )django_urlsc                   @   s$   e Zd ZejgZdd Zdd ZdS )ExampleProtectedViewc                 O   s   t tddS NT)successr   dictselfargskwargs r!   ./dj_rest_auth/tests/urls.pyget   s    zExampleProtectedView.getc                 O   s   t tddS r   r   r   r!   r!   r"   post   s    zExampleProtectedView.postN)__name__
__module____qualname__r   IsAuthenticatedpermission_classesr#   r$   r!   r!   r!   r"   r      s   r   c                   @   s   e Zd ZeZdS )FacebookLoginNr%   r&   r'   r   adapter_classr!   r!   r!   r"   r*   #   s   r*   c                   @   s   e Zd ZeZeZdS )TwitterLoginN)r%   r&   r'   r   r,   r   serializer_classr!   r!   r!   r"   r-   '   s   r-   c                   @   s   e Zd ZeZdS )FacebookConnectNr+   r!   r!   r!   r"   r/   ,   s   r/   c                   @   s   e Zd ZeZeZdS )TwitterConnectN)r%   r&   r'   r   r,   r   r.   r!   r!   r!   r"   r0   0   s   r0   c                   @   s   e Zd ZdS )TwitterLoginSerializerFooN)r%   r&   r'   r!   r!   r!   r"   r1   5   s   r1   POSTc                 C   s&   t dddd| id}|jdd d S )N1122334455667788)access_tokentoken_secretrequest)datacontextT)raise_exception)r1   is_valid)r7   
serializerr!   r!   r"   twitter_login_view9   s
    r=   c                   @   s   e Zd ZeZdS )TwitterLoginNoAdapterN)r%   r&   r'   r   r.   r!   r!   r!   r"   r>   B   s   r>   GETc                 C   s   t  S )Nr
   )r7   r!   r!   r"   get_csrf_cookieF   s    r@   z^rest-registration/zdj_rest_auth.registration.urlsz^test-admin/z"^account-email-verification-sent/$account_email_verification_sent)namez)^account-confirm-email/(?P<key>[-:\w]+)/$account_confirm_emailz^social-login/facebook/$fb_loginz^social-login/twitter/$tw_loginz^social-login/twitter-no-view/$tw_login_no_viewz"^social-login/twitter-no-adapter/$tw_login_no_adapterz ^social-login/facebook/connect/$
fb_connectz^social-login/twitter/connect/$
tw_connectz^socialaccounts/$social_account_listz^protected-view/$z(^socialaccounts/(?P<pk>\d+)/disconnect/$social_account_disconnectz
^accounts/zallauth.socialaccount.urlsz	^getcsrf/getcsrfz^token/verify/Ztoken_verifyz^token/refresh/token_refreshN)-Z.allauth.socialaccount.providers.facebook.viewsr   Z-allauth.socialaccount.providers.twitter.viewsr   Zdjango.conf.urlsr   r   django.views.decorators.csrfr   Zdjango.views.genericr   rest_frameworkr   Zrest_framework.decoratorsr	   rest_framework.responser   rest_framework.viewsr   rest_framework_simplejwt.viewsr   Zdj_rest_auth.jwt_authr   dj_rest_auth.registration.viewsr   r   r   r   Zdj_rest_auth.social_serializersr   r   Zdj_rest_auth.urlsr    r   r   r*   r-   r/   r0   r1   r=   r>   r@   as_viewr!   r!   r!   r"   <module>   sr   

   