示例#1
0
)

urlpatterns = [
    # URLs that do not require a session or valid token
    path('password/reset/',
         PasswordResetView.as_view(),
         name='rest_password_reset'),
    path('password/reset/confirm/',
         PasswordResetConfirmView.as_view(),
         name='rest_password_reset_confirm'),
    path('login/', LoginView.as_view(), name='rest_login'),
    # URLs that require a user to be logged in with a valid session / token.
    path('logout/', LogoutView.as_view(), name='rest_logout'),
    path('user/', UserDetailsView.as_view(), name='rest_user_details'),
    path('password/change/',
         PasswordChangeView.as_view(),
         name='rest_password_change'),
]

if getattr(settings, 'REST_USE_JWT', False):
    from rest_framework_simplejwt.views import TokenVerifyView

    from dj_rest_auth.jwt_auth import get_refresh_view

    urlpatterns += [
        path('token/verify/', TokenVerifyView.as_view(), name='token_verify'),
        path('token/refresh/',
             get_refresh_view().as_view(),
             name='token_refresh'),
    ]
示例#2
0
from allauth.account.views import confirm_email
from dj_rest_auth.views import (
    LoginView, LogoutView, PasswordChangeView, UserDetailsView)


admin.site.site_header = 'GuOJ 后台管理'

routers = routers.DefaultRouter()
routers.register('users', UserViewSet, basename='user')
routers.register('problemsets', ProblemSetViewSet, basename='problemset')
routers.register('problems', ProblemViewSet, basename='problem')
routers.register('notice', NoticeViewSet, basename='notice')


urlpatterns = [
    path('admin/', admin.site.urls),
    path('api/', include(routers.urls)),
    re_path(r'^api/auth/login/$', LoginView.as_view(), name='rest_login'),
    # URLs that require a user to be logged in with a valid session / token.
    re_path(r'^api/auth/logout/$', LogoutView.as_view(), name='rest_logout'),
    re_path(r'^api/auth/user/$', UserDetailsView.as_view(),
            name='rest_user_details'),
    re_path(r'^api/auth/password/change/$', PasswordChangeView.as_view(),
            name='rest_password_change'),
    re_path(r'^api/auth/password/reset/',
            include('django_rest_passwordreset.urls', namespace='password_reset')),
    path('api/auth/registration/', include('dj_rest_auth.registration.urls')),
]

urlpatterns += staticfiles_urlpatterns()
示例#3
0
from django.conf import settings
from django.urls import path

from dj_rest_auth.views import (LoginView, LogoutView, PasswordChangeView,
                                PasswordResetConfirmView, PasswordResetView,
                                UserDetailsView)

urlpatterns = [
    # URLs that do not require a session or valid token
    path('password/reset/', PasswordResetView.as_view(), name='rest_password_reset'),
    path('password/reset/confirm/', PasswordResetConfirmView.as_view(), name='rest_password_reset_confirm'),
    path('login/', LoginView.as_view(), name='rest_login'),
    # URLs that require a user to be logged in with a valid session / token.
    path('logout/', LogoutView.as_view(), name='rest_logout'),
    path('user/', UserDetailsView.as_view(), name='rest_user_details'),
    path('password/change/', PasswordChangeView.as_view(), name='rest_password_change'),
]

if getattr(settings, 'REST_USE_JWT', False):
    from rest_framework_simplejwt.views import TokenVerifyView

    from dj_rest_auth.jwt_auth import get_refresh_view

    urlpatterns += [
        path('token/verify/', TokenVerifyView.as_view(), name='token_verify'),
        path('token/refresh/', get_refresh_view().as_view(), name='token_refresh'),
    ]
示例#4
0
from django.urls import path, include
from django.urls import re_path
from dj_rest_auth.views import LoginView, LogoutView, PasswordChangeView

from customAuthentication.views import CustomConfirmEmailView


urlpatterns = [
    #google auth
    path('', include('allauth.socialaccount.providers.google.urls')),

    path('login/', LoginView.as_view(),
         name='login'),
    path('logout/', LogoutView.as_view(),
         name='logout'),
    path('password/change/', PasswordChangeView.as_view(),
         name='password-change'),

    re_path('registration/account-confirm-email/(?P<key>.+)/',
            CustomConfirmEmailView.as_view(), name='account_confirm_email'),
    path('registration/', include('dj_rest_auth.registration.urls')),
]

示例#5
0
from dj_rest_auth.views import (LoginView, PasswordChangeView, LogoutView)
from django.urls import path

from members.views import (SignupView, MemberDeleteView, MemberInfoView,
                           MemberInfoCreateView, MemberImagesView,
                           MemberPersonalitiesView, MemberRibbonsView)

urlpatterns = [
    path('auth/signup/', SignupView.as_view()),
    path('auth/login/', LoginView.as_view()),
    path('auth/logout/', LogoutView.as_view()),
    path('auth/password/change/', PasswordChangeView.as_view()),
    path('auth/delete/', MemberDeleteView.as_view()),
    path('member/images/', MemberImagesView.as_view()),
    path('member/personalities/', MemberPersonalitiesView.as_view()),
    path('member/info/', MemberInfoView.as_view()),
    path('member/info/create/', MemberInfoCreateView.as_view()),
    path('member/ribbons/', MemberRibbonsView.as_view()),
]