Esempio n. 1
0
    url(r'^test-admin/', include(django_urls)),
    url(r'^account-email-verification-sent/$',
        TemplateView.as_view(),
        name='account_email_verification_sent'),
    url(r'^account-confirm-email/(?P<key>[-:\w]+)/$',
        TemplateView.as_view(),
        name='account_confirm_email'),
    url(r'^social-login/facebook/$', FacebookLogin.as_view(), name='fb_login'),
    url(r'^social-login/twitter/$', TwitterLogin.as_view(), name='tw_login'),
    url(r'^social-login/twitter-no-view/$',
        twitter_login_view,
        name='tw_login_no_view'),
    url(r'^social-login/twitter-no-adapter/$',
        TwitterLoginNoAdapter.as_view(),
        name='tw_login_no_adapter'),
    url(r'^social-login/facebook/connect/$',
        FacebookConnect.as_view(),
        name='fb_connect'),
    url(r'^social-login/twitter/connect/$',
        TwitterConnect.as_view(),
        name='tw_connect'),
    url(r'^socialaccounts/$',
        SocialAccountListView.as_view(),
        name='social_account_list'),
    url(r'^protected-view/$', ExampleProtectedView.as_view()),
    url(r'^socialaccounts/(?P<pk>\d+)/disconnect/$',
        SocialAccountDisconnectView.as_view(),
        name='social_account_disconnect'),
    url(r'^accounts/', include('allauth.socialaccount.urls'))
]
Esempio n. 2
0
def twitter_login_view(request):
    serializer = TwitterLoginSerializerFoo(
        data={'access_token': '11223344', 'token_secret': '55667788'},
        context={'request': request}
    )
    serializer.is_valid(raise_exception=True)


class TwitterLoginNoAdapter(SocialLoginView):
    serializer_class = TwitterLoginSerializer


urlpatterns += [
    url(r'^rest-registration/', include('dj_rest_auth.registration.urls')),
    url(r'^test-admin/', include(django_urls)),
    url(r'^account-email-verification-sent/$', TemplateView.as_view(),
        name='account_email_verification_sent'),
    url(r'^account-confirm-email/(?P<key>[-:\w]+)/$', TemplateView.as_view(),
        name='account_confirm_email'),
    url(r'^social-login/facebook/$', FacebookLogin.as_view(), name='fb_login'),
    url(r'^social-login/twitter/$', TwitterLogin.as_view(), name='tw_login'),
    url(r'^social-login/twitter-no-view/$', twitter_login_view, name='tw_login_no_view'),
    url(r'^social-login/twitter-no-adapter/$', TwitterLoginNoAdapter.as_view(), name='tw_login_no_adapter'),
    url(r'^social-login/facebook/connect/$', FacebookConnect.as_view(), name='fb_connect'),
    url(r'^social-login/twitter/connect/$', TwitterConnect.as_view(), name='tw_connect'),
    url(r'^socialaccounts/$', SocialAccountListView.as_view(), name='social_account_list'),
    url(r'^socialaccounts/(?P<pk>\d+)/disconnect/$', SocialAccountDisconnectView.as_view(),
        name='social_account_disconnect'),
    url(r'^accounts/', include('allauth.socialaccount.urls'))
]
Esempio n. 3
0
    SocialAccountDisconnectView,
)

from common.views import user
from common.views import social_connect as sc

# app_name = "common"
router = DefaultRouter()
router.register(r"users", user.UserViewSet)

urlpatterns = [
    # custom user info
    path("user_info/", include(router.urls)),
    # auth
    path("", include("dj_rest_auth.urls")),
    path("registration/", include("dj_rest_auth.registration.urls")),
    # social
    path("facebook/", sc.FacebookLogin.as_view(), name="fb_login"),
    path("twitter/", sc.TwitterLogin.as_view(), name="twitter_login"),
    path("facebook/connect/", sc.FacebookConnect.as_view(), name="fb_connect"),
    path("twitter/connect/", sc.TwitterConnect.as_view(), name="twitter_connect"),
    path(
        "socialaccounts/", SocialAccountListView.as_view(), name="social_account_list"
    ),
    path(
        "socialaccounts/<int:pk>/disconnect/",
        SocialAccountDisconnectView.as_view(),
        name="social_account_disconnect",
    ),
]