Ejemplo n.º 1
0
 def test_user_login(self):
     request = self.factory.post(reverse('accounts:login'), {
         'username': '******',
         'password': '******'
     })
     response = LoginView.as_view()(request)
     self.assertEqual(response.url, reverse('accounts:website_list'))
Ejemplo n.º 2
0
    def test_form_valid(self, mock_get_auth_user, mock_auth, mock_remote_login,
                        mock_get_user_id, mock_get_and_update_user):
        # Fake user and required attributes
        user = self.user
        user.backend = 'accounts.authentication.WocatCMSAuthenticationBackend'
        mock_get_auth_user.return_value = user
        mock_auth.return_value = user

        mock_remote_login.return_value = 1
        mock_get_user_id.return_value = 1
        mock_get_and_update_user.return_value = self.user

        form = WocatAuthenticationForm
        form.get_user = lambda x: user
        # Add message store
        request = RequestFactory().post(
            reverse('login'),
            data={'form': form(initial=self.invalid_login_credentials)})
        request.user = user
        request.session = MagicMock()
        request._messages = FallbackStorage

        view = self.setup_view(LoginView(), request)

        response = view.form_valid(
            form(initial=self.invalid_login_credentials))

        self.assertEqual(request.user, self.user)
        self.assertEqual(response.url, reverse('home'))
Ejemplo n.º 3
0
 def test_user_login(self):
     request = self.factory.post(reverse('accounts:login'), {
         'username': '******',
         'password': '******'
     })
     response = LoginView.as_view()(request)
     self.assertEqual(response.url, reverse('accounts:website_list'))
Ejemplo n.º 4
0
    def test_get(self):
        lv = LoginView()
        request = WSGIRequest({
            'REQUEST_METHOD': 'POST',
            'PATH_INFO': 'accounts:login',
            'wsgi.input': StringIO()})
        mock_wsgi_session_context()

        expect = render(
            request,
            'accounts/login.html',
            {'form': LoginForm()}
        )
        result = lv.get(request)
        self.assertEqual(
            remove_csrf(result.content.decode('utf-8')),
            remove_csrf(expect.content.decode('utf-8'))
        )
Ejemplo n.º 5
0
    def test_login(self):
        user = User.objects.create(username='******')
        user.backend = ''
        view = LoginView()
        request = RequestFactory()
        request.GET = {}
        request.META = {}
        request.user = None
        request.session = self.client.session
        request.session.create()
        view.request = request

        form = self.moxx.CreateMock(UsernameLoginForm)
        form.get_user().AndReturn(user)

        self.moxx.ReplayAll()
        view.form_valid(form)
        self.moxx.VerifyAll()

        self.assertTrue(request.user)
Ejemplo n.º 6
0
    def test_post__when_form_is_valid(self, mock_form):
        mock_form.return_value.is_valid.return_value = True

        def getitem(name):
            return COR_APPUSER_DATA_1st['username']
        mock_form.return_value.data = MagicMock()
        mock_form.return_value.data.__getitem__.side_effect = getitem

        lv = LoginView()
        request = WSGIRequest({
            'REQUEST_METHOD': 'POST',
            'PATH_INFO': 'accounts:login',
            'wsgi.input': StringIO()})
        mock_wsgi_session_context()

        expect = redirect('travel:place_list')
        result = lv.post(request)
        self.assertEqual(
            remove_csrf(result.content.decode('utf-8')),
            remove_csrf(expect.content.decode('utf-8'))
        )
Ejemplo n.º 7
0
    def test_form_valid(self):
        """
        Check if the user is authenticated.
        """
        # add test User account
        user = UserFactory()
        user.set_password('123')
        user.save()

        # create LoginView
        view = LoginView()
        view.request = self.generate_request()

        # create LoginForm
        form = LoginForm()
        form.data = {'username': user.username,
                     'password': '******'}
        form.cleaned_data = form.clean()

        # test now
        view.form_valid(form)
        self.assertEqual(view.request.user.username, user.username)
        self.assertTrue(view.request.user.is_authenticated())
Ejemplo n.º 8
0
 def test_dispatch(self):
     request = self.factory.get(reverse('login'))
     setattr(request, 'user', self.user)
     view = self.setup_view(LoginView(), request)
     response = view.dispatch(view.request, *view.args, **view.kwargs)
     self.assertEqual(response.status_code, 302)
Ejemplo n.º 9
0
                base_name='Trạng thái thi công')
# router.register(r'lich-thi-cong', LichThiCongApi.LichThiCongView, base_name="Lịch thi công")
router.register(r'chi-tiet-lich-thi-cong',
                ChiTietLichThiCongApi.ChiTietLichThiCongView,
                base_name="Chi tiết lịch thi công")
router.register(r'nhom-thi-cong', NhomThiCongView, base_name="Nhóm thi công")
router.register(r'chuc-nang', PhanQuyenApi.ChucNangView, base_name="Chức năng")
router.register(r'quyen-nguoi-dung',
                PhanQuyenApi.QuyenNguoiDungView,
                base_name="Quyền người dùng")
router.register(r'chuc-nang-nguoi-dung',
                PhanQuyenApi.ChucNangNguoiDungView,
                base_name="Chức năng người dùng")

urlpatterns = [
    path('admin/', admin.site.urls),
    path('login/', csrf_exempt(LoginView.as_view()), name='login'),
    path('logout/', LogoutView.as_view(), name='logout'),
    # path('user/', RegisterView.as_view(), name="đăng kí người dùng"),
    path('infomations-by-token/',
         ThongTinNguoiDungTheoToken.InformationsByToken.as_view(),
         name='Thông tin người dùng từ token'),
    path('', include(router.urls)),
]

# urlpatterns = format_suffix_patterns(urlpatterns)

if settings.DEBUG:
    urlpatterns += static(settings.MEDIA_URL,
                          document_root=settings.MEDIA_ROOT)
Ejemplo n.º 10
0
 def test_password_label(self):
     request = LoginView.as_view()
     form = LoginForm(request)
     self.assertEqual(form.fields['password'].label, 'Password')
Ejemplo n.º 11
0
                    #register_page
                    )
""" from products.views import ( ProductListView, 
                             Product_list_view, 
                             ProductDetailView,
                             ProductDetailSlugView, 
                             Product_detail_view,
                             ProductFeaturedListView,
                             ProductFeaturedDetailView,
                            ) """
urlpatterns = [
    url(r'^$', home_page, name="home"),
    url(r'^about/$', about_page, name="about"),
    url(r'^contact/$',contact_page, name="contact"),
    #url(r'^login/$', login_page, name="login"),
    url(r'^login/$', LoginView.as_view(), name="login"),
    url(r'^logout/$', LogoutView.as_view(), name="logout"),
    url(r'^api/cart/$', cart_detail_api_view, name="api-cart"),
    #url(r'^register/$', register_page, name="register"),
    url(r'^register/$', RegisterView.as_view( ), name="register"),
    url(r'^checkout/address/create/$', checkout_address_create_view, name="checkout_address_create"),
    url(r'^checkout/address/reuse/$', checkout_address_reuse_view, name="checkout_address_reuse"),
    url(r'^register/guest/$', guest_register_view, name="guest_register"),
    url(r'^bootstrap/$', TemplateView.as_view(template_name="bootstrap/justExample.html")),
    url(r'^products/', include(("products.urls", 'products'), namespace='products')),
    url(r'^cart/', include(("carts.urls", 'cart'), namespace='cart')),
    url(r'^billing/payment-method/$', payment_method_view, name="billing-payment-method"),
    url(r'^billing/payment-method/create/$', payment_method_createview, name="billing-payment-method-endpoint"),
    url(r'^search/', include(("search.urls", 'search'), namespace='search')),
    #url(r'^featured/$', ProductFeaturedListView.as_view()),
    #url(r'^featured/(?P<pk>\d+)/$', ProductFeaturedDetailView.as_view()),
Ejemplo n.º 12
0
from django.conf.urls import url

from accounts.views import LoginView, LogoutView

urlpatterns = [
    url(r'login/$', LoginView.as_view()),
    url(r'logout/$', LogoutView.as_view()),
]
Ejemplo n.º 13
0
The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/1.8/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  url(r'^$', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  url(r'^$', Home.as_view(), name='home')
Including another URLconf
    1. Add an import:  from blog import urls as blog_urls
    2. Add a URL to urlpatterns:  url(r'^blog/', include(blog_urls))
"""
from django.conf.urls import include, url
from django.contrib import admin

from accounts.views import LoginView, LogoutView

urlpatterns = [
    #
    # accounts.LoginView also doubles as the home page
    url(r'^$', LoginView.as_view(template_name='home.html'),
        name='home'),
    url(r'^accounts/logout$', LogoutView.as_view(), name='logout'),
    url(r'^accounts/login/$', LoginView.as_view(template_name='home.html')),
    #
    url(r'^admin/', include(admin.site.urls)),
    url(r'^icdcodes/', include("icdcodes.urls")),
    url(r'^historias/', include("historias.urls")),
]
Ejemplo n.º 14
0
from django.conf.urls import patterns, url

from accounts.views import LoginView, LogoutView, RegisterView, ForgotPasswordView, PasswordResetView, ChangePasswordView

urlpatterns = patterns(
    '',
    url(r'^login/$', LoginView.as_view(), name='accounts_login'),
    url(r'^logout/$', LogoutView.as_view(), name='accounts_logout'),
    url(r'^register/$', RegisterView.as_view(), name='accounts_register'),
    url(r'^forgot_password/$', ForgotPasswordView.as_view(), name='accounts_forgot_password'),
    url(r'^change_password/$', ChangePasswordView.as_view(), name='accounts_change_password'),
    url(r'^password_reset/(?P<user_id>\d+)-(?P<reset_code>\w+)/$',
        PasswordResetView.as_view(), name='accounts_password_reset'),
)
Ejemplo n.º 15
0
    url(r'^', include('home.urls')),
    url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
    url(r'^admin/', include(admin.site.urls)),
    url(r'^admin_tools/', include('admin_tools.urls')),
    url(r'^photos/', include('photos.urls')),
    url(r'^bsdfs/', include('bsdfs.urls')),
    url(r'^normals/', include('normals.urls')),
    url(r'^shapes/', include('shapes.urls')),
    url(r'^mturk/', include('mturk.urls')),
    url(r'^analytics/', include('analytics.urls')),
    url(r'^intrinsic/', include('intrinsic.urls')),
    url(r'^accounts/', include('accounts.urls')),

    # django-user-accounts with some custom modifications
    url(r'^account/signup/$', SignupView.as_view(), name='account_signup'),
    url(r'^account/login/$', LoginView.as_view(), name='account_login'),
    url(r'^account/signup-ajax/$', SignupViewAjax.as_view(), name='account_signup_ajax'),
    url(r'^account/login-ajax/$', LoginViewAjax.as_view(), name='account_login_ajax'),
    url(r'^account/', include('account.urls')),

    # captcha
    url(r'^captcha/', include('captcha.urls')),
)

# media files
from django.conf.urls.static import static
from django.conf import settings
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

# static files
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
Ejemplo n.º 16
0
from django.conf.urls import url
from accounts.views import SignupView, LoginView, LogoutView, DeleteView
from accounts.views import ConfirmEmailView, resendConfirmation
from accounts.views import ChangePasswordView, PasswordResetView, PasswordResetTokenView
from accounts.views import UserSettingsView

urlpatterns = [
    url(r"^resend/$", resendConfirmation, name="resend_confirmation"),
    url(r"^signup/$", SignupView.as_view(), name="account_signup"),
    url(r"^login/$", LoginView.as_view(), name="account_login"),
    url(r"^logout/$", LogoutView.as_view(), name="account_logout"),
    url(r"^confirm_email/(?P<key>\w+)/$",
        ConfirmEmailView.as_view(),
        name="account_confirm_email"),
    url(r"^password/$", ChangePasswordView.as_view(), name="account_password"),
    url(r"^password/reset/$",
        PasswordResetView.as_view(),
        name="account_password_reset"),
    url(r"^password/reset/(?P<uidb36>[0-9A-Za-z]+)-(?P<token>.+)/$",
        PasswordResetTokenView.as_view(),
        name="account_password_reset_token"),
    url(r"^settings/$", UserSettingsView.as_view(), name="account_settings"),
    url(r"^delete/$", DeleteView.as_view(), name="account_delete"),
]
Ejemplo n.º 17
0
from django.urls import path

from accounts.views import user_profile, LogoutView, LoginView, RegisterView, user_profile_edit

urlpatterns = [
    # path('login/', login_user, name='login user'),
    path('login/', LoginView.as_view(), name='login user'),  # CBV
    # path('logout/', logout_user, name='logout user'),
    path('logout/', LogoutView.as_view(), name='logout user'),  # CBV
    # path('register/', register_user, name='register user'),
    path('register/', RegisterView.as_view(), name='register user'),  # CBV
    # path('profile/', user_profile, name='current user profile'),
    path('profile/<int:pk>', user_profile, name='user profile'),
    path('edit/<int:pk>', user_profile_edit, name='user profile edit'),
]
Ejemplo n.º 18
0
from django.urls import path
from django.utils.translation import ugettext_lazy as _
from django.contrib.auth import views as auth_views

from accounts.views import (LoginRequestView, LoginSentView, LoginView,
                            LoginResultView, RegisterView, RegisterSuccessView,
                            ProfileView, ContributorProfileView)

urlpatterns = [
    path(_('register/'), RegisterView.as_view(), name='register'),
    path(_('register-success/'),
         RegisterSuccessView.as_view(),
         name='register_success'),
    path(_('logout/'), auth_views.LogoutView.as_view(), name='logout'),
    path(_('login-request/'), LoginRequestView.as_view(),
         name='login_request'),
    path(_('login-sent/'), LoginSentView.as_view(), name='login_sent'),
    path(_('login/<uidb64>/<token>/'), LoginView.as_view(), name='login'),
    path(_('login-result/'), LoginResultView.as_view(), name='login_result'),
    path(_('profile/'), ProfileView.as_view(), name='profile'),
    path(_('contributor-profile/'),
         ContributorProfileView.as_view(),
         name='contributor_profile')
]
Ejemplo n.º 19
0
"""mfi_systems_api URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/2.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.contrib import admin
from django.urls import path, include
from accounts.views import LoginView

urlpatterns = [
    path('admin/', admin.site.urls),
    path('auth/login/', LoginView.as_view(), name="auth-login"),
    path('api/v1/', include('members.urls'), name="member-routes"),
    path('api/v1/', include('loans_management.urls'), name="loans-routes"),
    path('api/v1/',
         include('mfi_statistics.urls'),
         name="mfi-statistics-routes"),
    path('api/v1/', include('institution.urls'), name="institution-routes"),
]
Ejemplo n.º 20
0
from django.urls import path
from accounts.views import RegisterView, LoginView, LogoutView

app_name = 'accounts'
urlpatterns = [
    path('register/', RegisterView.as_view(), name='accounts-register'),
    path('login/', LoginView.as_view(), name='accounts-login'),
    path('logout/', LogoutView.as_view(), name='accounts-logout'),
]
Ejemplo n.º 21
0
    CreateTagView,
    TagSnippetsView
)
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()

urlpatterns = patterns('',
    url(
        r'^$', 
        HomeView.as_view(),
        name='home'
    ),
    url(
        r'^login/$', 
        LoginView.as_view(),
        name='login'
    ),
    url(
        r'^logout/$', 
        'django.contrib.auth.views.logout',
        {'next_page': settings.LOGIN_URL},
        name='logout'
    ),

    ################################
    # snippets
    ################################
    url(
        r'^snippets/$', 
        SnippetsView.as_view(),
Ejemplo n.º 22
0
from django.conf.urls import patterns, include, url
from django.contrib import admin
from accounts.views import LoginView, LogoutView
from django.core.urlresolvers import reverse_lazy

admin.autodiscover()

urlpatterns = patterns('',
    # Examples:
    # url(r'^$', 'djangotemplate.views.home', name='home'),
    # url(r'^blog/', include('blog.urls')),

    url(r'^login/$', LoginView.as_view(), name="login"),
    url(r'^logout/$', LogoutView.as_view(), { "next_page": reverse_lazy("index") }, name="logout"),
)

Ejemplo n.º 23
0
from django.urls import path
from django.conf.urls import include, url
from django.contrib.staticfiles.urls import static
from django.contrib.staticfiles.urls import staticfiles_urlpatterns

from knox import views as knox_views
from accounts.views import LoginView

urlpatterns = [
    path('admin/', admin.site.urls),
    path('', views.home, name="home"),
    path('accounts/', include('accounts.urls')),
    path('animals/', include('animals.urls')),
    path('evac/', include('evac.urls')),
    path('hotline/', include('hotline.urls')),
    path('intake/', include('intake.urls')),
    path('location/', include('location.urls')),
    path('people/', include('people.urls')),
    path('shelter/', include('shelter.urls')),
    url(r'login/', LoginView.as_view(), name='knox_login'),
    url(r'logout/', knox_views.LogoutView.as_view(), name='knox_logout'),
]
urlpatterns += staticfiles_urlpatterns()
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

if settings.DEBUG:
    urlpatterns += [
        url(r'^media/(?P<path>.*)$', serve,
            {'document_root': settings.MEDIA_ROOT})
    ]
Ejemplo n.º 24
0
from django.conf.urls import url, include
from django.contrib import admin

from accounts.views import SignUpView, LogoutView, LoginView, ResendView, ChangePasseordView

urlpatterns = [
    url(r'^email_confirmation/',
        include('email_confirm_la.urls', namespace='email_confirm_la')),
    url(r'^email_confirmation/resend/(?P<username>\w+)/',
        ResendView.as_view()),
    url(r'^signup/', SignUpView.as_view()),
    url(r'^login/', LoginView.as_view()),
    url(r'^logout/', LogoutView.as_view()),
    url(r'^changepassword/', ChangePasseordView.as_view()),
]
Ejemplo n.º 25
0
from django.contrib import admin
from django.urls import path, include

from knox import views as knox_views
from accounts.views import LoginView

urlpatterns = [
    path('admin/', admin.site.urls),
    path('core/', include('core.urls')),
    path('login/', LoginView.as_view()),
    path('logout/', knox_views.LogoutView.as_view()),
    path('logoutall/', knox_views.LogoutAllView.as_view()),
]
Ejemplo n.º 26
0
# coding: utf-8
from django.conf.urls import patterns, url
from django.contrib.auth import views
from django.contrib.auth.decorators import login_required, user_passes_test

from accounts.views import (
    RegistrationView,
    LoginView,
    LogOut,
    ProfileView,
    ProfileSettingsView,
    ProfileAccessView,
    ProfileModelsListView,
)


urlpatterns = patterns(
    u"accounts.views",
    url(r"^register/$", RegistrationView.as_view(), name=u"registration"),
    url(r"^login/$", LoginView.as_view(), name=u"login"),
    url(r"^logout/$", LogOut.as_view(), name=u"logout"),
    url(r"^profile/$", login_required(ProfileView.as_view()), name=u"profile"),
    url(r"^profile/settings/$", login_required(ProfileSettingsView.as_view()), name=u"profile_settings"),
    url(r"^profile/access/$", login_required(ProfileAccessView.as_view()), name=u"profile_access"),
    url(r"^profile/models_list/$", login_required(ProfileModelsListView.as_view()), name=u"profile_models_list"),
)
Ejemplo n.º 27
0
from django.conf.urls import include, url
from rest_framework import routers

from accounts.views import AccountViewSet, LoginView, LogoutView

router = routers.SimpleRouter(trailing_slash=False)
# Accounts Routes
router.register(r'accounts', AccountViewSet, 'accounts')

urlpatterns = [
    url(r'^auth/login$', LoginView.as_view(), name='login'),
    url(r'^auth/logout$', LogoutView.as_view(), name='logout'),
    url(r'^', include(router.urls)),
]
Ejemplo n.º 28
0
from django.conf.urls import patterns, include, url
from django.contrib import admin
from django.views.generic import TemplateView

from accounts.views import LoginView
from exercises.views.admin import (CategoryFillView, CategoryDuplicateView,
                                   ChanceCreateView, ChanceDetailView,
                                   ProgramAuditView, ProgramReplaceView,
                                   ProgramUsageAuditView)
from clients.views import ClientsImportView, InvoiceDataView

admin.autodiscover()

urlpatterns = patterns(
    '',
    url(r'^home/$', LoginView.as_view(), name='home'),
    url(r'^sair/$', 'django.contrib.auth.views.logout', name='logout'),
    url(r'^recuperar-senha/$',
        'django.contrib.auth.views.password_reset',
        name='password_reset'),
    url(r'^recuperar-senha/ok/$',
        'django.contrib.auth.views.password_reset_done',
        name='password_reset_done'),
    url(r'^recuperar-senha/(?P<uidb64>[0-9A-Za-z_\-]+)/(?P<token>[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})/$',
        'django.contrib.auth.views.password_reset_confirm',
        name='password_reset_confirm'),
    url(r'^recuperar-senha/confirmar/ok/$',
        'django.contrib.auth.views.password_reset_complete',
        name='password_reset_complete'),
    url(r'^$',
        TemplateView.as_view(template_name='soon_available.html'),
Ejemplo n.º 29
0
from django.urls import path, re_path, include
from django.views.generic import TemplateView, RedirectView
from django.contrib.auth.views import LogoutView
from addresses.views import checkout_address_create_view, checkout_address_reuse_view
from carts.views import cart_detail_api_view
from billing.views import payment_method_view, payment_method_createview
from marketing.views import MarketingPreferenceUpdateView, MailchimpWebhookView
from orders.views import LibraryView
from analytics.views import SalesView, SalesAjaxView

urlpatterns = [
    re_path(r'^$', home_page, name='home'),
    re_path(r'^bootstrap/$',
            TemplateView.as_view(template_name='bootstrap/example.html')),
    re_path(r'^about/$', about_page, name='about'),
    re_path(r'^login/$', LoginView.as_view(), name='login'),
    re_path(r'^checkout/address/create/$',
            checkout_address_create_view,
            name='checkout_address_create'),
    re_path(r'^checkout/address/reuse/$',
            checkout_address_reuse_view,
            name='checkout_address_reuse'),
    re_path(r'^register/guest/$',
            GuestRegisterView.as_view(),
            name='guest_register'),
    re_path(r'^logout/$', LogoutView.as_view(), name='logout'),
    re_path(r'^register/$', RegisterView.as_view(), name='register'),
    re_path(r'^contact/$', contact, name='contact'),
    re_path(r'^billing/payment-method/$',
            payment_method_view,
            name='billing-payment-method'),
Ejemplo n.º 30
0
"""
from django.conf.urls import url, include, static
from django.contrib import admin
from django.contrib.auth import views as auth_views
from django.conf import settings

from accounts.views import (LoginView, UserDashboardView, user_signup_view,
                            user_signup_create)
from cleanups.views.template_views import (cleanup_new, cleanup_edit,
                                           cleanup_list, cleanup_show,
                                           cleanup_create, cleanup_update,
                                           cleanup_join_view, cleanup_delete)

urlpatterns = [
    # Homepage
    url(r'^$', LoginView.as_view(), name='home'),

    # Admin Pages
    url(r'^admin/', admin.site.urls),

    # API
    url(r'^api/v1/', include('api_urls', namespace='api')),

    # Auth
    url(r'^login/', LoginView.as_view(), name='login'),
    url(r'^logout/', auth_views.logout, {'next_page': '/'}, name='logout'),
    url(r'^signup/', user_signup_view, name='register'),
    url(r'^user/create', user_signup_create, name='create-user'),

    # User
    # TODO: Issue #83 - Move to accounts/urls.py
Ejemplo n.º 31
0
"""Url patterns for the accounts app."""

__all__ = ("urlpatterns", )

from django.urls import path

from rest_framework.routers import SimpleRouter

from accounts.views import UserView
from accounts.views import AccountViewSet
from accounts.views import LogoutView, LoginView
from accounts.views import RegisterEmployerViewSet
from accounts.views import RegisterEmployeesViewSet

router = SimpleRouter()

router.register("account", AccountViewSet, "account")

router.register("register-employers", RegisterEmployerViewSet,
                "register-employers")

router.register("register-employees", RegisterEmployeesViewSet,
                "register-employees")

urlpatterns = router.urls + [
    path("user/", UserView.as_view(), name="user"),
    path("login/", LoginView.as_view(), name="login"),
    path("logout/", LogoutView.as_view(), name="logout"),
]
Ejemplo n.º 32
0
urlpatterns = [
    url(r'^$', home_page, name='home'),
    url(r'^about/$', about_page, name='about'),
    #url(r'^accounts/login/$', RedirectView.as_view(url='/login')),
    url(r'^accounts/$', RedirectView.as_view(url='/account')),
    url(r'^account/', include("accounts.urls", namespace='account')),
    url(r'^accounts/', include("accounts.passwords.urls")),
    url(r'^address/$', RedirectView.as_view(url='/addresses')),
    url(r'^addresses/$', AddressListView.as_view(), name='addresses'),
    url(r'^addresses/create/$', AddressCreateView.as_view(), name='address-create'),
    url(r'^addresses/(?P<pk>\d+)/$', AddressUpdateView.as_view(), name='address-update'),
    url(r'^analytics/sales/$', SalesView.as_view(), name='sales-analytics'),
    url(r'^analytics/sales/data/$', SalesAjaxView.as_view(), name='sales-analytics-data'),
    url(r'^contact/$', contact_page, name='contact'),
    url(r'^login/$', LoginView.as_view(), name='login'),
    url(r'^checkout/address/create/$', checkout_address_create_view, name='checkout_address_create'),
    url(r'^checkout/address/reuse/$', checkout_address_reuse_view, name='checkout_address_reuse'),
    url(r'^register/guest/$', GuestRegisterView.as_view(), name='guest_register'),
    url(r'^logout/$', LogoutView.as_view(), name='logout'),
    url(r'^api/cart/$', cart_detail_api_view, name='api-cart'),
    url(r'^cart/', include("carts.urls", namespace='cart')),
    url(r'^billing/payment-method/$', payment_method_view, name='billing-payment-method'),
    url(r'^billing/payment-method/create/$', payment_method_createview, name='billing-payment-method-endpoint'),
    url(r'^register/$', RegisterView.as_view(), name='register'),
    url(r'^bootstrap/$', TemplateView.as_view(template_name='bootstrap/example.html')),
    url(r'^library/$', LibraryView.as_view(), name='library'),
    url(r'^orders/', include("orders.urls", namespace='orders')),
    url(r'^products/', include("products.urls", namespace='products')),
    url(r'^search/', include("search.urls", namespace='search')),
    url(r'^settings/$', RedirectView.as_view(url='/account')),
Ejemplo n.º 33
0
from django.conf.urls import patterns, url
from accounts.views import LoginView, LogoutView, RegistrationView

urlpatterns = patterns('',
                       url(r'^users/sign_in$', LoginView.as_view(),
                           name='accounts.views.login'),
                       url(r'^users/sign_out$', LogoutView.as_view(),
                           name='accounts.views.logout'),
                       url(r'^registration/new$', RegistrationView.as_view(),
                           name='accounts.views.registration'),
                       )
Ejemplo n.º 34
0
 def test_email_label(self):
     request = LoginView.as_view()
     form = LoginForm(request=request)
     self.assertEqual(form.fields['email'].label, 'Email')
Ejemplo n.º 35
0
urlpatterns = [
    # Examples:
    url(r'^$', HomeView.as_view(template_name='dashboard.html'), name='home'),
    url(r'^about/$', 'promanage.views.about', name='about'),
    url(r'^account/', include('accounts.urls')),
    url(r'^program/', include('programs.urls')),
    url(r'^group/', include('groups.urls')),
    url(r'^permission/', include('permissions.urls')),
    url(r'^schedule/', include('schedules.urls')),
    url(r'^scheduledaily/', include('scheduledaily.urls')),
    url(r'^genschedule/', include('genschedule.urls')),
    url(r'^lineschedule/', include('lineschedule.urls')),
    url(r'^reworkschedule/', include('reworkschedule.urls')),
    url(r'^workreports/', include('workreports.urls')),
    # superadmin 
    url(r'^nimda/', include(admin.site.urls)),

    # auth user
    url(r'^login/$', LoginView.as_view(template_name='AdminLTE/login.html'), name='auth_login'),
    url(r'^logout/$', 'accounts.views.auth_logout', name='auth_logout'),



    #test view
    url(r'^test/$', 'promanage.views.test', name='test'),
]

if settings.DEBUG:
    urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
    urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
Ejemplo n.º 36
0
from django.conf import settings
from django.urls import include, path
from knox import views as knox_views

from accounts.views import CheckCreds, LoginView

urlpatterns = [
    path("checkcreds/", CheckCreds.as_view()),
    path("login/", LoginView.as_view()),
    path("logout/", knox_views.LogoutView.as_view()),
    path("logoutall/", knox_views.LogoutAllView.as_view()),
    path("api/v3/", include("apiv3.urls")),
    path("clients/", include("clients.urls")),
    path("agents/", include("agents.urls")),
    path("checks/", include("checks.urls")),
    path("services/", include("services.urls")),
    path("winupdate/", include("winupdate.urls")),
    path("software/", include("software.urls")),
    path("core/", include("core.urls")),
    path("automation/", include("automation.urls")),
    path("tasks/", include("autotasks.urls")),
    path("logs/", include("logs.urls")),
    path("scripts/", include("scripts.urls")),
    path("alerts/", include("alerts.urls")),
    path("accounts/", include("accounts.urls")),
]

if hasattr(settings, "ADMIN_ENABLED") and settings.ADMIN_ENABLED:
    from django.contrib import admin

    urlpatterns += (path(settings.ADMIN_URL, admin.site.urls), )
Ejemplo n.º 37
0
 def setUp(self):
     self.invalid_login_credentials = {'username': '******', 'password': '******'}
     self.factory = RequestFactory()
     self.factory.GET = MagicMock()
     self.user = create_new_user()
     self.view = self.setup_view(view=LoginView(), request=self.factory)
Ejemplo n.º 38
0
from django.urls import path
from accounts.views import LoginView, register_view, logout_view

app_name = 'accounts'

urlpatterns = [
    path('login', LoginView.as_view(), name="login"),
    path('register', register_view, name="register"),
    path('logout', logout_view, name="logout"),
]
Ejemplo n.º 39
0
from django.conf.urls.static import static
from django.contrib import admin
from django.contrib.auth.views import LogoutView
from django.urls import path, include, re_path
from django.views.generic import TemplateView

from accounts.views import LoginView, RegisterView, guest_register_view
from addresses.views import checkout_address_create_view, checkout_address_reuse_view
from carts.views import cart_detail_api_view
from .views import home_page, about_page, contact_page

urlpatterns = [
    re_path(r'^$', home_page, name='home'),
    re_path(r'^about/$', about_page),
    re_path(r'^contact/$', contact_page, name="contact"),
    re_path(r'^login/$', LoginView.as_view(), name="login"),
    re_path(r'^checkout/address/create/$',
            checkout_address_create_view,
            name="checkout_address_create"),
    re_path(r'^checkout/address/reuse/$',
            checkout_address_reuse_view,
            name="checkout_address_reuse"),
    re_path(r'^register/guest/$', guest_register_view, name="guest_register"),
    re_path(r'^logout/$', LogoutView.as_view(), name="logout"),
    re_path(r'^api/cart/$', cart_detail_api_view, name="api-cart"),
    re_path(r'^cart/', include(("carts.urls", "carts"), namespace="cart")),
    re_path(r'^register/$', RegisterView.as_view(), name="register"),
    re_path(r'^bootstrap/$',
            TemplateView.as_view(template_name="bootstrap/example.html")),
    re_path(r'^products/',
            include(("products.urls", "products"), namespace="products")),
Ejemplo n.º 40
0
from orders.views import LibraryView

from .views import home_page, about_page, contact_page

urlpatterns = [
    url(r'^$', home_page, name='home'),
    url(r'^about/$', about_page, name='about'),
    url(r'^accounts/$', RedirectView.as_view(url='/account')),
    url(r'^account/', include("accounts.urls", namespace='account')),
    url(r'^accounts/', include("accounts.passwords.urls")),
    url(r'^address/$', RedirectView.as_view(url='/addresses')),
    url(r'^addresses/$', AddressListView.as_view(), name='addresses'),
    url(r'^addresses/create/$', AddressCreateView.as_view(), name='address-create'),
    url(r'^addresses/(?P<pk>\d+)/$', AddressUpdateView.as_view(), name='address-update'),
    url(r'^contact/$', contact_page, name='contact'),
    url(r'^login/$', LoginView.as_view(), name='login'),
    url(r'^checkout/address/create/$', checkout_address_create_view, name='checkout_address_create'),
    url(r'^checkout/address/reuse/$', checkout_address_reuse_view, name='checkout_address_reuse'),
    url(r'^register/guest/$', GuestRegisterView.as_view(), name='guest_register'),
    url(r'^logout/$', LogoutView.as_view(), name='logout'),
    url(r'^api/cart/$', cart_detail_api_view, name='api-cart'),
    url(r'^cart/', include("carts.urls", namespace='cart')),
    url(r'^billing/payment-method/$', payment_method_view, name='billing-payment-method'),
    url(r'^billing/payment-method/create/$', payment_method_createview, name='billing-payment-method-endpoint'),
    url(r'^register/$', RegisterView.as_view(), name='register'),
    url(r'^bootstrap/$', TemplateView.as_view(template_name='bootstrap/example.html')),
    url(r'^library/$', LibraryView.as_view(), name='library'),
    url(r'^orders/', include("orders.urls", namespace='orders')),
    url(r'^products/', include("products.urls", namespace='products')),
    url(r'^search/', include("search.urls", namespace='search')),
    url(r'^settings/$', RedirectView.as_view(url='/account')),
Ejemplo n.º 41
0
from django.conf.urls import url
from accounts.views import LoginView, LogoutView, SignupView

app_name = 'accounts'

urlpatterns = [
    url("^signup/$", SignupView.as_view(), name='signup'),
    url("^login/$", LoginView.as_view(), name="login"),
    url("^logout/$", LogoutView.as_view(), name="logout"),
]

Ejemplo n.º 42
0
"""django_email_login 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.contrib import admin
from django.urls import path

from accounts.views import LoginView, RegisterView
from django.views.generic.base import TemplateView

urlpatterns = [
    path('', TemplateView.as_view(template_name='home.html'), name='home'),
    path('admin/', admin.site.urls),
    path('login/', LoginView.as_view(), name='login'),
    path('register/', RegisterView.as_view(), name='register')
]
Ejemplo n.º 43
0
from django.conf.urls import patterns, include, url
from django.contrib import admin
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from django.contrib.auth.decorators import login_required
from tastypie.api import Api
from accounts.api import AccountLeadResource
from accounts.api import MailingListsResource
from accounts.views import LoginView
from accounts.views import AccountView

from django.contrib.auth.views import login
from django.contrib.auth.views import logout

v1_api = Api(api_name='v1')
v1_api.register(AccountLeadResource())
v1_api.register(MailingListsResource())

admin.autodiscover()

urlpatterns = patterns('',
    (r'^$', LoginView.as_view()),
    url(r'^login/$', login, {'template_name': 'login.html'}, name="login"),
    url(r'^logout/$', logout, {'template_name': 'logout.html'}, name="logout"),
    (r'^accounts/$', login_required(AccountView.as_view())),
    (r'^api/', include(v1_api.urls)),
    url(r'^admin/', include(admin.site.urls)),
)

urlpatterns += staticfiles_urlpatterns()