Beispiel #1
0
def test_user_login_witn_invalid_email(rf):
    login_view = Login.as_view()

    request = rf.get('/user/login/[email protected]&password=password')
    response = login_view(request=request)

    assert response.status_code == 404
Beispiel #2
0
def test_user_login_with_invalid_password(rf):
    reg_view = Registration.as_view()
    activate_view = UserActivation.as_view()
    login_view = Login.as_view()

    request = rf.get(
        '/user/registration/[email protected]&password=password')
    response = reg_view(request=request)

    res_message = response.content.decode("utf-8")
    pick_url = re.findall(rex_pattern, res_message)[0]
    activation_url = "/user" + pick_url.split("user")[1]
    request = rf.get(activation_url)
    response = activate_view(request=request)

    request = rf.get('/user/login/[email protected]&password=password1')
    response = login_view(request=request)

    assert response.status_code == 401
Beispiel #3
0
def test_user_login_witn_valid_credentials_when_locked(rf):
    reg_view = Registration.as_view()
    activate_view = UserActivation.as_view()
    login_view = Login.as_view()

    request = rf.get(
        '/user/registration/[email protected]&password=password')
    response = reg_view(request=request)

    res_message = response.content.decode("utf-8")
    pick_url = re.findall(rex_pattern, res_message)[0]
    activation_url = "/user" + pick_url.split("user")[1]
    request = rf.get(activation_url)
    response = activate_view(request=request)

    for i in range(MAX_INVALID_LOG_IN_TRY):
        request = rf.get(
            '/user/login/[email protected]&password=password1')
        response = login_view(request=request)

    request = rf.get('/user/login/[email protected]&password=password')
    response = login_view(request=request)

    assert response.status_code == 423
Beispiel #4
0
from django.urls import path
from users.views import Registration, UserActivation, Login

urlpatterns = [
    path('registration/', Registration.as_view(), name='registration'),
    path('activate/', UserActivation.as_view(), name='activate'),
    path('login/', Login.as_view(), name='login'),
]

Beispiel #5
0
from django.conf.urls import patterns, include, url
from users import views

from users.views import UsersIndexView, UserShowView 
from users.views import Login, Logout, SignUp, AccountView
from django.contrib.auth.decorators import login_required

urlpatterns = patterns('',
    url('^users/$', UsersIndexView.as_view(), name = "index"),
    url('^users/(?P<pk>\d+)$', UserShowView.as_view(), name = "show"),
    url(r'^users/account/', login_required(AccountView.as_view()), name="account"),
    url(r'^users/([0-9]+)/$', 'users.views.user_page', name="user_page"),

    url(r'^login/', Login.as_view(), name="login"),
    url(r'^logout/', Logout.as_view(), name="logout"),
    url(r'^signup/', SignUp.as_view(), name="signup"),

)

Beispiel #6
0
from django.urls import path, include
from users import views
from users.views import PersonSignUp, CompanySignUp, ProfileUpdate, Login

urlpatterns = [
    path('person-list/', views.PersonList.as_view()),
    path('company-list/', views.CompanyList.as_view()),
    path('person-signup/', PersonSignUp.as_view()),
    path('company-signup/', CompanySignUp.as_view()),
    path('accounts/profile/', ProfileUpdate.as_view()),
    path('login/', Login.as_view()),
]
Beispiel #7
0
from django.conf.urls import patterns, include, url
from django.contrib import admin
from users.views import Index, Create, Login, Logout

urlpatterns = patterns('',
    url(r'^$', Index.as_view() ),
    url(r'^create', Create.as_view() ),
    url(r'^login', Login.as_view() ),
    url(r'^logout', Logout.as_view() ),

)
from django.conf.urls import include, url, patterns
from django.contrib import admin
from users.views import Login, Register, Logout

urlpatterns = patterns('users.views',
    url(r'^login/$', Login.as_view(), name='login'),
    url(r'^register/$', Register.as_view(), name='register'),
    url(r'^logout/$', Logout.as_view(), name='logout'),
)
Beispiel #9
0
from django.conf.urls import patterns, include, url
from django.contrib import admin
from users.views import Index, Create, Login, Logout

urlpatterns = patterns(
    '',
    url(r'^$', Index.as_view()),
    url(r'^create', Create.as_view()),
    url(r'^login', Login.as_view()),
    url(r'^logout', Logout.as_view()),
)
Beispiel #10
0
from django.conf.urls import patterns, include, url
from django.contrib import admin
from seeseeHOME.views import Home

from django.contrib.auth.decorators import login_required
admin.autodiscover()

from users.views import Login
from users.views import Logout
from users.views import AccountView
from users.views import SignUp

urlpatterns = patterns(
    '',
    # Examples:
    # url(r'^$', 'seeseeHOME.views.home', name='home'),
    # url(r'^blog/', include('blog.urls')),
    url(r'^$', Home.as_view(), name="home"),
    url(r'^login/', Login.as_view(), name="login"),
    url(r'^logout/', Logout.as_view(), name="logout"),
    url(r'^account/', login_required(AccountView.as_view()), name="account"),
    url(r'^admin/', include(admin.site.urls)),
    url(r'^users/', include('users.urls', namespace='users')),
    url(r'^signup/', SignUp.as_view(), name="signup"),
)
Beispiel #11
0
"""dkango URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/2.2/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    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 users.views import Login, Files, SpiderOperate, SpiderInfo, SpiderFile

urlpatterns = [
    path('admin/', admin.site.urls),
    path('user/login', Login.as_view()),
    path('files/post', Files.as_view()),
    path('spiders', SpiderOperate.as_view()),
    path('spider/<slug:id>', SpiderInfo.as_view()),
    path('spider/<slug:id>/dir', SpiderFile.as_view())
]
Beispiel #12
0
from django.conf.urls import patterns, url

from users.views import EditUser, Login, Logout, SignUp


urlpatterns = patterns('users.views',
    url(r'^login/$', Login.as_view(), name='users_Login'),
    url(r'^logout/$', Logout.as_view(), name='users_Logout'),
    url(r'^signup/$', SignUp.as_view(), name='users_SignUp'),
    url(r'^edit/(?P<id>[0-9]+)$', EditUser.as_view(), name='users_EditUser'),
)
Beispiel #13
0
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.decorators import login_required

from products.views import Inicio
from users.views import Login,register,logoutUsuario 

urlpatterns = [
    path('admin/', admin.site.urls),
    path('products/',include('products.urls')),
    path('',login_required(Inicio.as_view()), name='index'),
    path('accounts/login/',Login.as_view(), name='login'),
    path('register/', register, name='register'),
    path('logout', login_required(logoutUsuario), name= 'logout'),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

Beispiel #14
0
"""assignment_project URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/3.1/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from django.views.decorators.csrf import csrf_exempt
from django.urls import path
from subscription.views import Subscriptions, Products
from users.views import Users, Login

urlpatterns = [
    path('api/subscriptions', csrf_exempt(Subscriptions.as_view())),
    path('api/products', csrf_exempt(Products.as_view())),
    path('api/users', csrf_exempt(Users.as_view())),
    path('api/login', csrf_exempt(Login.as_view())),
]
Beispiel #15
0
from django.urls import path
from django.contrib.auth.views import LogoutView

from users.views import Login

urlpatterns = [
    path("inloggen/", Login.as_view(), name="login"),
    path("uitloggen/", LogoutView.as_view(), name="logout"),
]
Beispiel #16
0
from django.contrib import admin
from django.urls import path, include
from .views import Index
from users.views import Login, SignUp, logout
from historydetails.views import historyDetails
from middleware.auth import auth_middleware

urlpatterns = [
    path('', Index.as_view(), name='home'),
    path('login', Login.as_view(), name="login"),
    path('signup', SignUp.as_view(), name="signup"),
    path('search', auth_middleware(Index.as_view()), name="search"),
    path('logout', logout, name="logout"),
    path('allhistory', historyDetails.as_view(), name="allhistory"),
]
Beispiel #17
0
    Logout,
    Signup,
    ActivateUser,
    ResetPassword,
    FollowUserToggle,
    ProfileImage,
)

urlpatterns = [
    # User Object
    url(r'^$', UserList.as_view(), name='list'),
    url(r'^(?P<pk>\d+)/$', UserDetail.as_view(), name='detail'),

    # User Follow
    url(r'^(?P<pk>\d+)/follow/$', FollowUserToggle.as_view(), name='follow'),

    # User profile image
    url(r'^(?P<pk>\d+)/profile-img/$',
        ProfileImage.as_view(),
        name='profile-img'),

    # User Login/Signup
    url(r'^login/$', Login.as_view(), name='login'),
    url(r'^logout/$', Logout.as_view(), name='logout'),
    url(r'^signup/$', Signup.as_view(), name='signup'),
    url(r'^activate/$', ActivateUser.as_view(), name='activate'),
    url(r'^google_login/$', GoogleLogin.as_view(), name='google-login'),
    url(r'^facebook_login/$', FacebookLogin.as_view(), name='facebook-login'),
    url(r'^password/$', ResetPassword.as_view(), name='password'),
]
Beispiel #18
0
from django.urls import path
from django.contrib.auth.decorators import login_required
from gen.users.views import logout_view
from users.views import (Register, Login, Profile, Orders, OrderDetail,
                         ReviewProducts)

urlpatterns = [
    path(r'login/', Login.as_view(), name='user_login'),
    path(r'logout/', logout_view, name='logout'),
    path(r'register/', Register.as_view(), name='user_register'),
    path(r'profile/', login_required(Profile.as_view()), name='profile'),
    path(r'orders/', login_required(Orders.as_view()), name='user_orders'),
    path(r'review/products/',
         login_required(ReviewProducts.as_view()),
         name='user_review_products'),
    path(r'<int:pk>/order/',
         login_required(OrderDetail.as_view()),
         name='user_order_detail'),
]