예제 #1
0
def test_user_login_view(rf, user, user_data):
    user.set_password(user_data.get('password'))
    user.save()
    request = rf.post(
        '/login/',
        content_type='application/json',
        HTTP_AUTHORIZATION=f'Basic {user_data.get("auth")}'
    )

    response = UserLoginView.as_view()(request)
    assert response.status_code == OK
예제 #2
0
# Django imports.
from django.urls import path, include
from django.views.generic.base import TemplateView

# App imports.
from accounts.views import (
	UserLoginView, SetPasswordView,
	UserDetailsView, UsersListView,
	UserSearchView
)


urlpatterns = [
    # # Route to register users.
    # path(r'register/', UserRegisterView.as_view(), name='user-register'),
    # Route to login registered users.
    path('', TemplateView.as_view(template_name = 'home.html'), name = 'home'),
    path('login/', include('django.contrib.auth.urls')),
    path('social-auth/', include('social_django.urls', namespace='social')),

    # APIs
    path('normal_login/', UserLoginView.as_view(), name='user-login'),
    path('set_password/', SetPasswordView.as_view(), name='set-password'),
    path('user/all/', UsersListView.as_view(), name='users-list'),
    path(r'user/<int:user_id>/', UserDetailsView.as_view(), name='user-details'),
    path('user/search/', UserSearchView.as_view(), name='user-search')
]
예제 #3
0
    path('vacancies/<int:vacancy_id>/send/',
         VacancySendView.as_view(),
         name='vacancy_send'),
    path('mycompany/', MycompanyView.as_view(), name='mycompany'),
    path('mycompany/create/',
         MycompanyCreateView.as_view(),
         name='mycompany_create'),
    path('mycompany/letsstart/',
         MycompanyLetsStartView.as_view(),
         name='my_company_lets_start'),
    path('mycompany/vacancies/',
         MyCompVacanciesView.as_view(),
         name='mycompany_vacancies'),
    path('mycompany/vacancies/<int:pk>/',
         MyCompVacancyUpdateView.as_view(),
         name='mycompany_vacancy'),
    path('mycompany/vacancies/create/',
         MyCompVacancyCreateView.as_view(),
         name='mycompany_vacancies_create'),
    path('mycompany/vacancies/letsstart/',
         MyCompVacancyLetsStartView.as_view(),
         name='mycompany_vacancies_letsstart'),
    path('login/', UserLoginView.as_view(), name='login'),
    path('register/', UserSignupView.as_view(), name='register'),
    path('logout/', LogoutView.as_view(), name='logout'),
]

if settings.DEBUG:
    urlpatterns += static(settings.MEDIA_URL,
                          document_root=settings.MEDIA_ROOT)
예제 #4
0
파일: urls.py 프로젝트: iopasd753951/YY
from django.urls import path, include

from accounts.views import UserSignupView, UserLoginView, UserLogoutView, UserMypageView

urlpatterns = [
    path('v1/signup', UserSignupView.as_view(), name="v1_user_signup"),
    path('v1/login', UserLoginView.as_view(), name="v1_user_login"),
    path('v1/loguot', UserLogoutView.as_view(), name="v1_user_logout"),
    path('v1/mypage', UserMypageView.as_view(), name="v1_user_mypage"),
]
예제 #5
0
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path
from django.contrib.auth.views import LogoutView
from django.views.generic.base import RedirectView
from django.conf.urls.static import static
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from task.views import TaskListView, TaskCreateOrUpdateView, TaskDetailView, TaskDeleteView
from accounts.views import UserRegistrationView, UserLoginView
from back_end import settings

urlpatterns = [
    path('admin/', admin.site.urls),

    # as_view() 初始化view class,返回句柄
    path('', RedirectView.as_view(url='task/')),
    path('task/', TaskListView.as_view()),
    path('task/create/', TaskCreateOrUpdateView.as_view()),
    path('task/<task_id>/', TaskDetailView.as_view()),
    path('task/<task_id>/update/', TaskCreateOrUpdateView.as_view()),
    path('task/<pk>/delete/', TaskDeleteView.as_view()),
    path('user/create/', UserRegistrationView.as_view()),
    path('user/login/', UserLoginView.as_view()),
    path('user/logout/', LogoutView.as_view())
]
if settings.DEBUG:
    urlpatterns += staticfiles_urlpatterns()
    urlpatterns += static(settings.MEDIA_URL,
                          document_root=settings.MEDIA_ROOT)
예제 #6
0
파일: urls.py 프로젝트: Jiaaan90/member
        ArticleCreateUpdateView.as_view()),  #게시판 수정
    #url(r'^article/(?P<article_id>\d+)/delete', ArticleDeleteView.as_view()), #삭제
    url(r'^comment/(?P<pk>\d+)/update/$', CommentUpdate.as_view()),
    url(r'^comment/(?P<pk>\d+)/delete/$', CommentDelete.as_view()),
    url(r'^article/(?P<pk>\d+)/comment/$',
        add_comment_to_post,
        name='add_comment_to_post'),
    url(r'^article/comment/', post_create),
    url(r'^article/(?P<article_id>\d+)/$',
        ArticleDetailView.as_view()),  #게시판 세부정보
    url(r'^article/create', ArticleCreateUpdateView.as_view()),  #게시물 만들기   
    #url(r'^article', add_comment, name='add_comment'),
    url(r'^article', ArticleListView.as_view()),  #게시판 전체 출력
    url(r'^index', index_get, name='index_get'),
    url(r'^accounts/mypage/', user_info, name='user_info'),  #마이페이지
    url(r'^accounts/create/', UserRegistrationView.as_view()),  #회원가입
    url(r'^accounts/login/', UserLoginView.as_view()),  #로그인
    url(r'^accounts/logout/', LogoutView.as_view()),  #로그아웃

    #url(r'^accounts/update/' views.update, name='update'),
    #url(r'^accounts/mypage', views.userinfo, name="mypage"),
    url(r'^admin/', admin.site.urls),

    #FBV방식
    #url(r'^hello/<to>', hello),
    #url(r'^article/', list_article),
    #url(r'^article/create/', create_or_update_article, {'article_id': None}), # {'article_id':None} 필수
    #url(r'^article/<article_id>/', detail_article),
    #url(r'^article/<article_id>/update/', create_or_update_article),
]
예제 #7
0
from django.urls import path
from django.contrib.auth.views import LogoutView as UserLogoutView

from accounts.views import UserLoginView, UserSignupView

app_name = "accounts"

urlpatterns = [
    path("login/", UserLoginView.as_view(), name="login"),
    path("signup/", UserSignupView.as_view(), name="signup"),
    path("logout/", UserLogoutView.as_view(), name="logout"),
]
예제 #8
0
파일: urls.py 프로젝트: davishek7/dj-Blog
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path, include
from django.conf import settings
from django.conf.urls.static import static
from django.contrib.auth import views as auth_views
from accounts.views import RegisterPage, UserLoginView

urlpatterns = [
    path('admin/', include('admin_honeypot.urls', namespace='admin_honeypot')),
    path('secret/', admin.site.urls),
    path('', include('posts.urls', namespace='posts')),
    path('accounts/', include('accounts.urls', namespace='accounts')),
    path('login/',
         UserLoginView.as_view(redirect_authenticated_user=True),
         name='login'),
    path('register/', RegisterPage.as_view(), name='register'),
    path('logout/',
         auth_views.LogoutView.as_view(next_page='login'),
         name='logout'),
    path('ckeditor/', include('ckeditor_uploader.urls')),
    path('password_change/',
         auth_views.PasswordChangeView.as_view(
             template_name='accounts/password_change.html'),
         name='password_change'),
    path('password_change_done/',
         auth_views.PasswordChangeDoneView.as_view(
             template_name='accounts/password_change_done.html'),
         name='password_change_done'),
    path('reset-password/',
예제 #9
0
from django.conf.urls import patterns, url

from accounts.views import (AccountCreateView, WelcomeTemplateView,
                            UserLoginView, UserLogoutView)
urlpatterns = patterns('',
    url(r'^signup/$', AccountCreateView.as_view(), name='signup'),
    url(r'^welcome/$', WelcomeTemplateView.as_view(), name='welcome'),
    url(r'^login/$', UserLoginView.as_view(), name='login'),
    url(r'^logout/$', UserLogoutView.as_view(), name='logout'),
)
예제 #10
0
from accounts.models import User
# from accounts.views import UserLoginViewSet
from accounts.views import UserInfoView, UserLoginView

from rest_framework.authtoken import views
from accounts import views

router = routers.DefaultRouter()
# router.register(r'users', UserLoginViewSet)
#

urlpatterns = [
    path('admin/', admin.site.urls),

    # Github
    # url(r'^accounts/', include('allauth.urls')),

    # drf
    url(r'^', include(router.urls)),
    url(r'^api-auth/',
        include('rest_framework.urls', namespace='rest_framework'))
]

urlpatterns += [
    # url(r'^api-token-auth/', views.obtain_auth_token),
    # 基于类的视图 APIView
    path(r'info/', UserInfoView.as_view()),
    url(r'user/', UserLoginView.as_view()),
    # test ok
    url(r'test/', views.test),
]
예제 #11
0
from django.conf.urls import patterns, url

from accounts.views import (AccountCreateView, WelcomeTemplateView,
                            UserLoginView, UserLogoutView)
urlpatterns = patterns(
    '',
    url(r'^signup/$', AccountCreateView.as_view(), name='signup'),
    url(r'^welcome/$', WelcomeTemplateView.as_view(), name='welcome'),
    url(r'^login/$', UserLoginView.as_view(), name='login'),
    url(r'^logout/$', UserLogoutView.as_view(), name='logout'),
)
예제 #12
0
# Django imports.
from django.urls import path

# App imports.
from accounts.views import UserRegisterView, UserLoginView

urlpatterns = [
    # Route to register users.
    path(r'register/', UserRegisterView.as_view(), name='user-register'),
    # Route to login registered users.
    path(r'login/', UserLoginView.as_view(), name='user-login')
]