예제 #1
0
파일: auth.py 프로젝트: yutaoxu/rssant
        Note that if you have architected your system such that email
        confirmations are sent outside of the request context `request`
        can be `None` here.
        """
        url = 'account-confirm-email/{}'.format(emailconfirmation.key)
        return urljoin(CONFIG.root_url, url)

    def send_confirmation_mail(self, request, emailconfirmation, signup):
        username = emailconfirmation.email_address.user.username
        link = self.get_email_confirmation_url(request, emailconfirmation)
        ctx = {
            "link": link,
            "username": username,
            "user": emailconfirmation.email_address.user,
            "key": emailconfirmation.key,
        }
        sender = self.get_from_email()
        receiver = emailconfirmation.email_address.email
        EMAIL_CONFIRM_TEMPLATE.send(sender, receiver, ctx)


urlpaterns = [
    path('auth/', include('rest_auth.urls')),
    path('auth/registration/', include('rest_auth.registration.urls')),
    path('auth/github/', GitHubLogin.as_view()),
    path('auth/github/connect/', GitHubConnect.as_view()),
    path('auth/socialaccount/', SocialAccountListView.as_view()),
    path('auth/socialaccount/<int:pk>/disconnect/', SocialAccountDisconnectView.as_view())
]
예제 #2
0
# Wire up our API using automatic URL routing.
# Additionally, we include login URLs for the browsable API.
urlpatterns = [
    url(r'^', include(router.urls)),
    url(r'^api-auth/',
        include('rest_framework.urls', namespace='rest_framework')),
    url(r'^rest-auth/registration/', include('rest_auth.registration.urls')),
    url(r'^rest-auth/facebook/$',
        views.FacebookLogin.as_view(),
        name='fb_login'),
    url(r'^rest-auth/twitter/$',
        views.TwitterLogin.as_view(),
        name='twitter_login'),
    url(r'^rest-auth/facebook/connect/$',
        views.FacebookConnect.as_view(),
        name='fb_connect'),
    url(r'^rest-auth/twitter/connect/$',
        views.TwitterConnect.as_view(),
        name='twitter_connect'),
    url(r'^rest-auth/', include('rest_auth.urls')),
    url(r'^api-token-auth/', obtain_jwt_token),
    url(r'^api-token-refresh/', refresh_jwt_token),
    url(r'^api-token-verify/', verify_jwt_token),
    url(r'^socialaccounts/$',
        SocialAccountListView.as_view(),
        name='social_account_list'),
    url(r'^socialaccounts/(?P<pk>\d+)/disconnect/$',
        SocialAccountDisconnectView.as_view(),
        name='social_account_disconnect')
]
예제 #3
0
    url(r'^auth/', include('rest_auth.urls')),
    url(r'^auth/registration/', include('rest_auth.registration.urls')),
    re_path(r'^auth/registration/account-confirm-email/', VerifyEmailView.as_view(),
            name='account_email_verification_sent'),
    url(r'^password/reset/$', PasswordResetView.as_view(),
        name='rest_password_reset'),
    re_path(
        r'^rest-auth/password/reset/confirm/(?P<uidb64>[0-9A-Za-z_\-]+)/(?P<token>[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})/$',
        PasswordResetConfirmView.as_view(), name='password_reset_confirm'),
    # re_path(r'^auth/registration/account-confirm-email/(?P<key>[-:\w]+)/$', VerifyEmailView.as_view(), name='account_confirm_email'),
    url(r'^auth/facebook/$', FacebookLogin.as_view(), name='fb_login'),
    url(r'^auth/twitter/$', TwitterLogin.as_view(), name='twitter_login'),
    url(r'^auth/facebook/connect/$', FacebookConnect.as_view(), name='fb_connect'),
    url(r'^auth/twitter/connect/$', TwitterConnect.as_view(), name='twitter_connect'),
    url(r'^social-accounts/$', SocialAccountListView.as_view(), name='social_account_list'),
    url(r'^social-accounts/(?P<pk>\d+)/disconnect/$', SocialAccountDisconnectView.as_view(),
        name='social_account_disconnect'),
    url(r'^api-token-verify/', verify_jwt_token),
    url(r'^api-token-refresh/', refresh_jwt_token),
    url(r'^api-token-auth/', obtain_jwt_token),

    path('email/<email>/change', EmailHandlerAPI.as_view({'post': 'change_email'}), name='change_email'),
    path('email/<email>/primary', EmailHandlerAPI.as_view({'post': 'make_email_primary'}), name='make_email_primary'),
    path('email/<email>/verify', EmailHandlerAPI.as_view({'post': 'send_confirmation'}), name='send_confirmation'),
    path('email/new', EmailHandlerAPI.as_view({'post': 'add_email'}), name='add_email'),

    # serve media
    url(r'^media/(?P<path>.*)$', serve, {'document_root': settings.MEDIA_ROOT, }, name='media'),
    url(r'^api/search/', include(search_index_urls)),

    url(r'^api/notification$', NotificationAPI.as_view()),
from django.urls import include, path
from rest_auth.registration.views import SocialAccountListView, SocialAccountDisconnectView

from swissrugbystats.api.auth import views

urlpatterns = [
    path('rest-auth/', include('rest_auth.urls')),
    path('accounts/', include('allauth.urls')),

    path('rest-auth/facebook', views.FacebookLogin.as_view(), name='fb_login'),
    path('rest-auth/twitter', views.TwitterLogin.as_view(), name='twitter_login'),

    # connect social media accounts
    path('rest-auth/facebook/connect', views.FacebookConnect.as_view(), name='fb_connect'),
    path('rest-auth/twitter/connect', views.TwitterConnect.as_view(), name='twitter_connect'),

    # list views of linked accounts
    path('socialaccounts', SocialAccountListView.as_view(), name='social_account_list'),
    path('socialaccounts/<int:pk>/disconnect', SocialAccountDisconnectView.as_view(),
         name='social_account_disconnect'),

    # JWT Authentication - currently disabled
    # re_path(r'^api-token-auth/?', obtain_jwt_token),
    # re_path(r'^api-token-refresh/?', refresh_jwt_token),

]
예제 #5
0
    url(r'^api/', include('product_review.urls')),
    url(r'^api/newsletter/', include('newsletter.api.urls')),
    url(r'^', include('django.contrib.auth.urls')),
    url(r'^rest-auth/', include('rest_auth.urls')),
    url(r'^rest-auth/registration/', include('rest_auth.registration.urls')),

    url(r'^rest-auth/social/facebook/$', views.FacebookLogin.as_view(), name='fb_login'),
    url(r'^rest-auth/social/twitter/$', views.TwitterLogin.as_view(), name='twitter_login'),
    url(r'^rest-auth/social/google/$', views.GoogleLogin.as_view(), name='google_login'),

    url(r'^rest-auth/facebook/connect/$', views.FacebookConnect.as_view(), name='fb_connect'),
    url(r'^rest-auth/google/connect/$', views.GoogleConnect.as_view(), name='google_connect'),
    url(r'^rest-auth/twitter/connect/$', views.TwitterConnect.as_view(), name='twitter_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'^account/', include('allauth.urls')),
    url(r'^api/$', APIHomeView.as_view(), name='home_api'),
    url(r'^api/products/$', ProductListAPIView.as_view(), name='products_api'),
    url(r'^api/sellers/$', SellerListAPIView.as_view(), name='sellers_api'),
    url(r'^api/brand/$', BrandListAPIView.as_view(), name='brands_api'),
    url(r'^api/dummy/$', DummyListAPIView.as_view(), name='dummy_api'),
    url(r'^api/categories/$', CategoryListAPIView.as_view(), name='categories_api'),
    url(r'^api/categories/(?P<pk>\d+)/$', CategoryRetrieveAPIView.as_view(), name='category_detail_api'),
    url(r'^api/products/(?P<pk>\d+)/$', ProductRetrieveAPIView.as_view(), name='products_detail_api'),
    url(r'^api/searchlist/$', SearchListAPIView.as_view(), name='search_list_api'),
    url(r'^api/filtered/$', FilteredListAPIView.as_view(), name='filtered_result_api'),
    url(r'^api/style/(?P<pk>\d+)/$', StyleRetrieveAPIView.as_view(), name='style_item_api'),
    url(r'^api/room/(?P<pk>\d+)/$', RoomRetrieveAPIView.as_view(), name='room_item_api'),
    url(r'^api/occasion/(?P<pk>\d+)/$', OccasionRetrieveAPIView.as_view(), name='occasion_item_api'),
예제 #6
0
from django.urls import path, include
from rest_auth.registration.views import SocialAccountDisconnectView
from .views import GoogleLogin, GoogleConnect

app_name = "social"

connect_urlpatterns = [path("google/", GoogleConnect.as_view(), name="google")]

login_urlpatterns = [path("google/", GoogleLogin.as_view(), name="google")]

urlpatterns = [
    # URLs to connect a social account to an **existing** user
    path("connect/", include((connect_urlpatterns, "social"), namespace="connect")),
    # URLs to sign up or login an user with a social login
    path("login/", include((login_urlpatterns, "social"), namespace="login")),
    # Disconnect an account from the user
    path(
        "disconnect/<int:pk>/", SocialAccountDisconnectView.as_view(), name="disconnect"
    ),
]
예제 #7
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('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'))
]