def test_logout(self): view = LogoutView() self.moxx.StubOutWithMock(auth, 'logout') auth.logout('request') self.moxx.StubOutWithMock(RedirectView, 'dispatch') RedirectView.dispatch('request') self.moxx.ReplayAll() view.dispatch('request') self.moxx.VerifyAll()
def test_get(self): """ Check if authenticated user is logged out """ # create test User account user = UserFactory() user.set_password('123') user.save() # create LogoutView view = LogoutView() view.request = self.generate_request() # test now user = auth.authenticate(username=user.username, password='******') auth.login(view.request, user) self.assertTrue(view.request.user.is_authenticated()) view.get(view.request) self.assertFalse(view.request.user.is_authenticated())
from django.conf.urls import url from accounts.views import UserDetails, AuthenticationView, LogoutView urlpatterns = [ url(r'^me$', UserDetails.as_view(), name='api-user-details'), url(r'^login$', AuthenticationView.as_view(), name='api-user-login'), url(r'^logout$', LogoutView.as_view(), name='api-user-logout'), ]
url(r'^uploads/(?P<path>.*)$', 'django.views.static.serve', { 'document_root': settings.MEDIA_ROOT, }), # url(r'^i18n/', include('django.conf.urls.i18n')), url(r'^home.html$', SignInAndSignUp.as_view(template_name='home.html'), name='home.html'), url(r'^$', SignInAndSignUp.as_view(template_name='home.html'), name='home'), url(r'^product/$', oscarstoreview.main, name='product'), url(r'^product-old/$', ProductView.as_view(), name='product-old'), url(r'^services/$', ServiceView.as_view(), name='services'), url(r'^contact/$', ContactView.as_view(), name='contact'), url(r'^about/$', AboutView.as_view(), name='about'), url(r'^accounts/logout$', LogoutView.as_view(), name='logout'), url(r'^admin/', include(admin.site.urls)), url(r'^oscar/', include(oscarapplication.urls)), url(r'^oscar/checkout/paypal/', include('paypal.express.urls')), url(r'^oscar/dashboard/paypal/express/', include(application.urls)), url(r'^paypal/redirect/', oscarstoreview.RedirectView.as_view(), name='paypal-redirect'), )
from django.urls import path from accounts.views import LoginView, LogoutView, UserCreateView, UserListView, UserUpdateView urlpatterns = [ path('login/', LoginView.as_view(), name='login'), path('logout/', LogoutView.as_view(), name='logout'), path('user/add/', UserCreateView.as_view(), name='user-add'), path('user/list/', UserListView.as_view(), name='user-list'), path('user/update/<pk>', UserUpdateView.as_view(), name="user-update"), ]
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"), ]
from django.urls import path from django.contrib.auth import views as auth_views from django.conf import settings from accounts.views import RegisterStaffUserView, EditProfileView, Staff from django.conf.urls.static import static from accounts.views import ( LogoutView, LoginView, ) urlpatterns = [ path('register/', RegisterStaffUserView.as_view(), name='register'), path('profile/', EditProfileView.as_view(), name='edit-profile'), path('staff-list/', Staff.as_view(), name='staff-list'), path('login', LoginView.as_view(), name="login"), path('logout', LogoutView.as_view(), name="logout"), # Password reset links (ref: https://github.com/django/django/blob/master/django/contrib/auth/views.py) path('password_change/done/', auth_views.PasswordChangeDoneView.as_view( template_name='registration/password_change_done.html'), name='password_change_done'), path('password_change/', auth_views.PasswordChangeView.as_view( template_name='registration/password_change.html'), name='password_change'), path('password_reset/done/', auth_views.PasswordResetCompleteView.as_view( template_name='registration/password_reset_done.html'), name='password_reset_done'), path('reset/<uidb64>/<token>/',
from django.urls import path, re_path from accounts.views import SignUpView, VerifyEmailView, ResetPasswordMailView, LoginView, LogoutView, \ UserDetailsView, ResetPasswordSendMailView, ChangePasswordView, RefreshAccessTokenView urlpatterns = [ path('signup/', SignUpView.as_view()), path('login/', LoginView.as_view()), path('logout/', LogoutView.as_view()), path('profile/', UserDetailsView.as_view()), re_path('^verify/email/(?P<token>.*)/$', VerifyEmailView.as_view()), path('reset/password/send/mail/', ResetPasswordSendMailView.as_view()), re_path('^reset/password/(?P<token>.*)/$', ResetPasswordMailView.as_view()), path('change/password/', ChangePasswordView.as_view()), path('refresh/access/token/', RefreshAccessTokenView.as_view()), ]
""" from django.conf import settings from django.conf.urls.static import static from django.contrib import admin from django.conf.urls import url, include from django.urls import path from vejasoh.api import api from vejasoh.startup import setup_streams from django.contrib.auth.decorators import login_required from accounts.views import LoginView, LogoutView, RegisterUserView from feeds.views import IndexView, FeedJsonView urlpatterns = [ url(r'^$', login_required(IndexView.as_view()), name='index'), url(r'^feeds/stream/(?P<pk>\d+)/feed/$', login_required(FeedJsonView.as_view()), name='stream-feed'), url(r'^accounts/login/$', LoginView.as_view(), name='user-login'), url(r'^accounts/logout/$', LogoutView.as_view(), name='user-logout'), url(r'^accounts/register/$', RegisterUserView.as_view(), name='user-register'), path('admin/', admin.site.urls), url(r'^api/', include(api.urls)), ] + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) setup_streams()
from django.conf.urls import url from accounts.views import LoginView, LogoutView urlpatterns = [ url(r'^auth/login/$', LoginView.as_view(), name='account-login'), url(r'^auth/logout/$', LogoutView.as_view(), name='account-logout'), ]
from django.conf.urls import patterns, url from accounts.views import ( LoginView, RegisterView, WebsiteListView, LogoutView, AddWebsiteView, WebsiteCreatedView, AccountSettingsView, EditWebsiteView, ) urlpatterns = patterns( "", url(r"^login/$", LoginView.as_view(), name="login"), url(r"^logout/$", LogoutView.as_view(), name="logout"), url(r"^account/$", AccountSettingsView.as_view(), name="settings"), url(r"^created/$", WebsiteCreatedView.as_view(), name="website_created"), url(r"^register/$", RegisterView.as_view(), name="register"), url(r"^websites/$", WebsiteListView.as_view(), name="website_list"), url(r"^addwebsite/$", AddWebsiteView.as_view(), name="add_website"), url(r"^editwebsite/(?P<website_id>\d)/$", EditWebsiteView.as_view(), name="edit_website"), url(r"^signup/$", RegisterView.as_view(), name="signup"), )
from django.contrib import admin from django.urls import path from accounts.views import MySignupView, MyLoginView, LogoutView from vacancies import views urlpatterns = [ path('admin/', admin.site.urls), path('', views.MainView.as_view(), name='main'), path('vacancies', views.ListVacanciesView.as_view(), name='list_vacancies'), path('vacancies/cat/<str:specialty>', views.ListSpecialtyView.as_view(), name='specialty_list'), path('companies/<int:company_id>', views.ListCompanyView.as_view(), name='company_list'), path('vacancies/<int:pk>', views.VacancyView.as_view(), name='vacancy'), path('vacancies/<int:pk>/send', views.SentVacancyView.as_view(), name='sent_application'), path('login', MyLoginView.as_view(), name='login_page'), path('logout', LogoutView.as_view(), name='logout_page'), path('register', MySignupView.as_view(), name='register_page'), path('mycompany/letsstart', views.MyCompanyLetStart.as_view(), name='lets_start'), path('mycompany/create', views.MyCompanyCreate.as_view(), name='mycompany_create'), path('mycompany', views.MyCompanyEdit.as_view(), name='mycompany'), ] if settings.DEBUG: urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) handler404 = views.custom_handler404 handler500 = views.custom_handler500
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"), )
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'), )
from django.urls import path from . import views from django.conf.urls import url from django.conf.urls.static import static from django.conf import settings from accounts.views import LogoutView app_name = 'accounts' urlpatterns = [ url(r'^register/$', views.register, name='register'), url(r'^user_login/$', views.user_login, name='user_login'), url(r'^user_logout/$', LogoutView.as_view(), name='user_logout'), path('profile/<int:pk>/', views.my_profile, name='my_profile'), path('profile/delete_all_my_photos', views.delete_all_my_photos, name='delete_all_my_photos'), ] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
from django.conf.urls import 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) urlpatterns = [ url(r'^auth/login$', LoginView.as_view(), name='login'), url(r'^auth/logout$', LogoutView.as_view(), name='logout'), ] urlpatterns += router.urls
def test_logout_url_resolves(self): """Checks if the logout url resolves""" url = reverse("logout") self.assertEquals( resolve(url).func.__name__, LogoutView.as_view().__name__)
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"), ]
from django.urls import path from oauth2_provider.views import AuthorizationView, TokenView from accounts.views import ( LabsProtectedViewSet, LoginView, LogoutView, ProductAdminView, ProtectedViewSet, UserSearchView, UUIDIntrospectTokenView, ) app_name = "accounts" urlpatterns = [ path("login/", LoginView.as_view(), name="login"), path("logout/", LogoutView.as_view(), name="logout"), path("search/", UserSearchView.as_view(), name="search"), path("authorize/", AuthorizationView.as_view(), name="authorize"), path("token/", TokenView.as_view(), name="token"), path("introspect/", UUIDIntrospectTokenView.as_view(), name="introspect"), path("productadmin/", ProductAdminView.as_view(), name="productadmin"), path("protected/", ProtectedViewSet.as_view(), name="protected"), path("labsprotected/", LabsProtectedViewSet.as_view(), name="labsprotected"), ]
from django.conf.urls import patterns, include, url from django.contrib import admin from accounts.views import SignInAndSignUp, LogoutView, AboutView admin.site.index_title = "SuperBook Secret Area" urlpatterns = patterns( '', url(r'^$', SignInAndSignUp.as_view(template_name='home.html'), name='home'), url(r'^about/$', AboutView.as_view(), name='about'), url(r'^accounts/logout$', LogoutView.as_view(), name='logout'), url(r'^secretarea/', include(admin.site.urls)), )
"""geo URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.11/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. Import the include() function: from django.conf.urls import url, include 2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls')) """ from django.conf.urls import url from django.contrib import admin from accounts.views import LoginView, LogoutView urlpatterns = [ url(r'^admin/', admin.site.urls), url(r'^login/$', LoginView.as_view(), name='login'), url(r'^logout/$', LogoutView.as_view(), name='logout'), ]
"""cop4710 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.urls import path from accounts.views import SignupView, LoginView, LogoutView, ProfileView, redirect_to_default_user_profile urlpatterns = [ path("signup/", SignupView.as_view(), name="accounts_signup"), path("login/", LoginView.as_view(), name="accounts_login"), path("logout/", LogoutView.as_view(), name="accounts_logout"), path("<pk>/", ProfileView.as_view(), name="accounts_view"), path("", redirect_to_default_user_profile), ]
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"), )
#Home and Post url path('home/', HomeView.as_view(), name="home"), url(r'^create-comment-post', createComment), url(r'^post/check-likes', checkLikesPost), url('post/count', checkLikesCountPost), path('admin/', admin.site.urls), path('cursos/', include("cursos.urls")), path('register/', RegisterView.as_view()), url(r'^login/$', auth_views.login, {'template_name': 'login/login.html'}, name="login"), url(r'^register/$', RegisterView.as_view(), {'template_name': 'login/register.html'}, name="register"), url(r'^logout/$', LogoutView.as_view(), name='logout', kwargs={'next_page': '/login'}), path('perfil/', Perfil.as_view(), name="perfil_usuario"), path('perfil/edit/', EditPerfil.as_view(), name="editar_perfil"), ##urls for articulos path('articulos/', Articulos.as_view(), name="articulos"), url('articulos/(?P<slug>[\w-]+)/$', ArticulosDetail.as_view(), name='articulos_detail'), url(r'^articulos/check-likes', checkLikes), url('articulos/count', checkLikesCount), url(r'^create-comment/articulo', createCommentArticle), ##urls for search bar
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")), ]
from django.conf.urls import url, patterns from accounts.views import RegisterView, ProfileView, LoginView, LogoutView,RegisterSuccessView,EditProfileView,FollowUser urlpatterns=patterns('', url(r'^register/$',RegisterView.as_view(),name="register"), url(r'^registersuccess/$',RegisterSuccessView.as_view(),name="register_success"), url(r'^login/$',LoginView.as_view(), name="login"), url(r'^logout/$', LogoutView.as_view(), name="logout"), url(r'^profile/(?P<username>[-\w\d]+)/$',ProfileView.as_view(),name="profile"), url(r'^profile/$',ProfileView.as_view(),name="myprofile"), url(r'^changepassword/$',ProfileView.as_view(),name="change_password"), url(r'^editprofile/$',EditProfileView.as_view(),name="edit_profile"), url(r'^follow/$',FollowUser.as_view()) )
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'), )
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'), ]
url(r'^deletefriend/(?P<id>[0-9]+)$', user_deletefriend_view, name='deletefriend'), url(r'^accounts/profile/$', TemplateView.as_view(template_name= 'profile.html'), name='profile'), url(r'^home/$', login_required(HomeView.as_view()) , name='home'), url(r'^posts/$', login_required(ListPostView.as_view()), name='posts'), url(r'^posts/(?P<id>[0-9]+)$', post_view, name='post'), url(r'^posts/(?P<id>[0-9]+)/edit$', post_edit_view, name='edit_post'), url(r'^posts/(?P<id>[0-9]+)/delete$', post_delete_view, name='delete_post'), # url(r'^posts/delete/all$', post_delete_view, name='delete_all_posts'), url(r'^users/(?P<id>[0-9]+)/posts$', user_posts_view, name='user_posts'), url(r'^posts/(?P<id>[0-9]+)/comments$', comment_view, name='comment'), url(r'^posts/(?P<id>[0-9]+)/comments/delete$', comment_delete_view, name='delete_comment'), url(r'^notifications/markasseen$', notification_view, name='notification_seen'), url(r'^users/message/(?P<id>[0-9]+)$', message_view, name='message'), url(r'^messages/markasread$', message_read_view, name='messages_read'), url(r'^sendmessage/(?P<id>[0-9]+)$', message_send_view, name='send_message'), url(r'^likecomment/(?P<id>[0-9]+)$', like_comment_view, name='like_comment'), url(r'^unlikecomment/(?P<id>[0-9]+)$', unlike_comment_view, name='unlike_comment'), url(r'^likepost/(?P<id>[0-9]+)$', like_post_view, name='like_post'), url(r'^unlikepost/(?P<id>[0-9]+)$', unlike_post_view, name='unlike_post'), url(r'^followuser/(?P<id>[0-9]+)$', follow_user_view, name='follow'), url(r'^unfollow/(?P<id>[0-9]+)$', unfollow_user_view, name='unfollow'), url(r'^logout/$', LogoutView.as_view(), name='logout'), )
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'), ]
from django.conf.urls import patterns, url from django.views.generic import TemplateView from accounts.views import LogoutView, TeamCreateView, TeamUpdateView, TeamAddUserView, TeamLeaveView, \ TeamDeleteView, UserDetailsView urlpatterns = patterns('', url(r'^login', TemplateView.as_view(template_name='accounts/login.html'), name='login'), url(r'^logout', LogoutView.as_view(), name='logout'), url(r'^(?P<team>[-a-zA-Z0-9_\.]+)/details', UserDetailsView.as_view(), name='user_details'), url(r'^teams/create', TeamCreateView.as_view(), name='team_create'), url(r'^teams/(?P<team>[-a-zA-Z0-9_\.]+)/modify', TeamUpdateView.as_view(), name='team_update'), url(r'^teams/(?P<team>[-a-zA-Z0-9_\.]+)/add', TeamAddUserView.as_view(), name='team_add_user'), url(r'^teams/(?P<team>[-a-zA-Z0-9_\.]+)/leave', TeamLeaveView.as_view(), name='team_leave'), url(r'^teams/(?P<team>[-a-zA-Z0-9_\.]+)/delete',
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'^$', 'loginform.views.home', name='home'), # url(r'^blog/', include('blog.urls')), url(r'^login/$', LoginView.as_view(), name="accounts/login"), url(r'^logout/$', LogoutView.as_view(), { "next_page": reverse_lazy("top") }, name="accounts/logout"), )