예제 #1
0
    def test_account_creation_after_signup(self):
        '''The user creates a new account with a username and password.'''
        # the anonymous user can visit the signup page
        get_request = self.factory.get('accounts:signup-form')
        get_request.user = self.unknown_user
        response = SignUpView.as_view()(get_request)
        # test that the form looks correct
        self.assertEqual(response.status_code, 200)
        self.assertContains(response, 'Sign Up')

        # simulate user making a new account with a username and password
        form_data = {
            'email': '*****@*****.**',
            'username': '******',
            'first_name': 'Zain',
            'last_name': 'Raza',
            'password1': 'Sc1ence_R0cks!',
            'password2': 'Sc1ence_R0cks!'
        }

        post_request = self.factory.post('/signup/', form_data)
        post_request.user = self.unknown_user
        # supply the message to the request
        setattr(post_request, 'session', 'session')
        messages = FallbackStorage(post_request)
        setattr(post_request, '_messages', messages)
        response = SignUpView.as_view()(post_request)
        # test the view and the User accounts after form submission
        self.assertEqual(response.status_code, 302)
        user = User.objects.get(username=form_data['username'])
        self.assertNotEqual(user, None)
        self.assertEqual(user.email, form_data['email'])
예제 #2
0
    def test_get(self):
        suv = SignUpView()
        request = WSGIRequest({
            'REQUEST_METHOD': 'POST',
            'PATH_INFO': 'accounts:signup',
            'wsgi.input': StringIO()})
        mock_wsgi_session_context()

        expect = render(
            request,
            'accounts/signup.html',
            {'form': SignUpForm()}
        )
        result = suv.get(request)
        self.assertEqual(
            remove_csrf(result.content.decode('utf-8')),
            remove_csrf(expect.content.decode('utf-8'))
        )
예제 #3
0
    def test_post__when_form_is_valid(self, mock_form):
        mock_form.return_value.is_valid.return_value = True
        mock_form.return_value.save.return_value = AppUser.objects.get(
            id=COR_APPUSER_DATA_1st['id'])

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

        suv = SignUpView()
        request = WSGIRequest({
            'REQUEST_METHOD': 'POST',
            'PATH_INFO': 'accounts:signup',
            'wsgi.input': StringIO()})
        mock_wsgi_session_context()

        expect = redirect('travel:place_list')
        result = suv.post(request)
        self.assertEqual(
            remove_csrf(result.content.decode('utf-8')),
            remove_csrf(expect.content.decode('utf-8'))
        )
예제 #4
0
파일: urls.py 프로젝트: burmystrov/wapp
router = SimpleRouter(trailing_slash=False)
router.register('android-devices',
                RegisterGCMDeviceViewSet,
                base_name='android-devices')
router.register('cars', UserCarsViewSet, base_name='cars')
router.register('car-mileages', CarMileageView, base_name='car-mileages')
router.register('cities', CityView, base_name='cities')
router.register('countries', CountryView, base_name='countries')
router.register('guidelines', GuidelinesViewSet, base_name='guidelines')
router.register('ios-devices',
                RegisterAPNSDeviceViewSet,
                base_name='ios-devices')
router.register('location-images',
                LocImageViewSet,
                base_name='location-images')
router.register('notification-options',
                NotificationOptionViewSet,
                base_name='notification-options')
router.register('profiles', ProfileView, base_name='profiles')
router.register('settings', UserSettingsViewSet, base_name='user-settings')
router.register('users', UserView, base_name='users')

urlpatterns = router.urls + [
    url(r'^login$', ObtainAuthToken.as_view(), name='login'),
    url(r'^oauth/(?P<provider_name>[a-z]+)$',
        OAuthConnectView.as_view(),
        name='oauth'),
    url(r'^registration$', SignUpView.as_view(), name='registration'),
]
예제 #5
0
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 SignUpView
from wiki.views import LoginView
"""
CHALLENGES:
    1. Uncomment the path() for the wiki app below. Use it to direct any request (except `/admin` URLs)
        to the the `wiki` app's URL configuration. Use the above docstring to guide you if you feel stuck.
    2. Make sure Django doesn't give you any warnings or errors when you execute `python manage.py runserver`.
"""
urlpatterns = [
    # Admin Site
    path('admin/', admin.site.urls),
    path('accounts/', include('django.contrib.auth.urls')),
    path('accounts/', include('accounts.urls')),
    path('templates/registration/signup/', SignUpView.as_view()),
    path('templates/registration/login', LoginView.as_view()),
    # Wiki App
    path('', include('wiki.urls')),
]
예제 #6
0
from django.urls import path
from accounts.views import SignUpView

urlpatterns = [
    path('new-user', SignUpView.as_view(), name='signup'),
]
예제 #7
0
from django.urls import path
from accounts.views import SignUpView
from rest_framework_simplejwt import views as jwt_views

urlpatterns = [
    path('register/', SignUpView.as_view(), name='user_register'),
    path('login/',
         jwt_views.TokenObtainPairView.as_view(),
         name='token_obtain_pair'),
    path('token/refresh/',
         jwt_views.TokenRefreshView.as_view(),
         name='token_refresh'),
]
예제 #8
0
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 django.conf import settings
from accounts.views import SignUpView
"""
CHALLENGES:
    1. Uncomment the path() for the wiki app below. Use it to direct any request (except `/admin` URLs)
        to the the `wiki` app's URL configuration. Use the above docstring to guide you if you feel stuck.
    2. Make sure Django doesn't give you any warnings or errors when you execute `python manage.py runserver`.
"""
urlpatterns = [
    # Admin Site
    path('admin/', admin.site.urls),

    # Wiki App
    path('', include('wiki.urls')),
    path('accounts/', include('django.contrib.auth.urls')),
    path('accounts/signup/', SignUpView.as_view(), name="signup"),
]
예제 #9
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.conf import settings

from django.conf.urls.static import static
from django.contrib import admin
from django.urls import path, include
from accounts.views import log_in, log_out, SignUpView
# from django.contrib.auth.views import LogoutView, PasswordResetView, LoginView, PasswordResetDoneView
urlpatterns = [
    path('admin/', admin.site.urls),
    path('', include('core.urls')),
    path('', include('accounts.urls')),
    path('accounts/', include('django.contrib.auth.urls')),
    path('signup/', SignUpView.as_view(), name="signup"),
    path('api-auth/', include('rest_framework.urls')),
    path('api/', include('api.urls')),
    path('api/', include('api.urls')),
    path('rest-auth/', include('rest_auth.urls')),
    path('rest-auth/registration/', include('rest_auth.registration.urls'))

    # path('login/', log_in, name="login"),
    # path('login/', LoginView.as_view(template_name='accounts/login.html'), name="login"),
    # path('logout/', LogoutView.as_view(), name="logout"),
    # path('reset_password/', PasswordResetView.as_view(
    #     template_name='accounts/rest_password.html'), name="reset_password"),
    # path('reset_password/', PasswordResetDoneView.as_view(
    #     template_name='accounts/rest_password_done.html'), name="password_reset_confirm")
] + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
예제 #10
0
from django.contrib.auth.views import LoginView, LogoutView
from django.urls import path

from accounts.views import SignUpView, ActivateView, DashboardView, CreateWebsite

urlpatterns = [
    path('signup', SignUpView.as_view(), name='signup'),
    path('signup/<str:account_type>', SignUpView.as_view(), name='signup-account-type'),
    path('activate/<str:uidb64>/<str:token>', ActivateView.as_view(), name='activate'),
    path('login', LoginView.as_view(template_name='accounts/login.html'), name='login'),
    path('account', DashboardView.as_view(), name='account'),
    path('account/new-website', CreateWebsite.as_view(), name='create-website'),
    path('logout', LogoutView.as_view(), name='logout'),
]
예제 #11
0
 def test_class_variable__is_registered_correctly(self):
     suv = SignUpView()
     self.assertEqual(
         suv.template_name,
         'accounts/signup.html'
     )
예제 #12
0
urlpatterns = [
    path("", operations_views.InitialPageListView.as_view(), name="home"),
    path("admin/", admin.site.urls),
    path("operacoes/", include("operations.urls", namespace="operations")),
    path("usuario/", include("users.urls", namespace="users")),
    path(f"{API_VERSION}/dados/",
         include("coredata.api_urls", namespace="coredata")),
    path(f"{API_VERSION}/operacoes/",
         include("operations.api_urls", namespace="api-operations")),
]

# Auth views
urlpatterns += [
    path("conta/login", auth_views.LoginView.as_view(), name="login"),
    path("conta/logout", auth_views.LogoutView.as_view(), name="logout"),
    path("conta/redefinir-senha",
         auth_views.PasswordResetView.as_view(),
         name="password_reset"),
    path("conta/redefinir-senha/enviado",
         auth_views.PasswordResetDoneView.as_view(),
         name="password_reset_done"),
    path(
        "conta/nova-senha/(?P<uidb64>[0-9A-Za-z_\-]+)/(?P<token>[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})",
        auth_views.PasswordResetConfirmView.as_view(),
        name="password_reset_confirm"),
    path("conta/nova-senha/pronto",
         auth_views.PasswordResetCompleteView.as_view(),
         name="password_reset_complete"),
    path("conta/cadastro", SignUpView.as_view(), name="signup"),
]
예제 #13
0
"""paper 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, include
from accounts.views import ProfileView, SignUpView

urlpatterns = [
    url(r'^',include("django.contrib.auth.urls")),
    url(r'^profile/$',ProfileView.as_view(),name="profile"),
    url(r'^signup/$',SignUpView.as_view(),name="signup"),
]
예제 #14
0
파일: urls.py 프로젝트: Maxium1997/Blog
from django.contrib import admin
from django.urls import path, include
from django.contrib.auth.views import LoginView, LogoutView

from accounts.views import SignUpView, Login

urlpatterns = [
    path(
        'accounts/',
        include([
            path('sign-up', SignUpView.as_view(), name='sign_up'),
            path('login',
                 Login.as_view(template_name='registration/login.html'),
                 name='login'),
            path('logout',
                 LogoutView.as_view(
                     template_name='registration/logged_out.html'),
                 name='logout'),

            # path('password_change/', include([
            #     path('', PasswordChangeView.as_view(), name='password_change'),
            #     path('done', PasswordChangeDoneView.as_view(), name='password_change_done'),
            # ])),
            #
            # path('password_reset/', include([
            #     path('', PasswordChangeView.as_view(), name='password_reset'),
            #     path('done', PasswordChangeDoneView.as_view(), name='password_reset_done'),
            # ])),
            #
        ])),
]
예제 #15
0
from django.urls import path
from accounts.views import SignUpView
from django.contrib.auth import views as auth_views

urlpatterns = [path('signup/', SignUpView.as_view(), name="accounts-signup")]
예제 #16
0
from django.contrib import admin
from django.urls import path, include
from accounts.views import SignUpView

urlpatterns = [
    path('signup/', SignUpView.as_view(), name='signup-page')
]
예제 #17
0
from django.urls import path

from accounts.views import SubmittableLoginView, SubmittablePasswordChangeView, SuccessMessagedLogoutView, SignUpView

app_name = 'accounts'

urlpatterns = [
    path("login/", SubmittableLoginView.as_view(), name='login'),
    path("signup/", SignUpView.as_view(), name='signup'),
    path("editpass/",
         SubmittablePasswordChangeView.as_view(),
         name='edit_pass'),
    path("logout/", SuccessMessagedLogoutView.as_view(), name='logout'),
]
예제 #18
0
from django.urls import path
from accounts.views import SignUpView

urlpatterns = [path("signup/", SignUpView.as_view(), name="signup")]
예제 #19
0
from django.urls import path

from accounts.views import SignUpView, SignInView, UserActivityView

urlpatterns = [
    path('sign-up-request', SignUpView.as_view()),
    path('sign-in-request', SignInView.as_view()),
    path('activity', UserActivityView.as_view()),
]
예제 #20
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()),
]
예제 #21
0
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, include
from accounts.views import SignUpView
"""
CHALLENGES:
    1. Uncomment the path() for the wiki app below. Use it to direct any request (except `/admin` URLs)
        to the the `wiki` app's URL configuration. Use the above docstring to guide you if you feel stuck.
    2. Make sure Django doesn't give you any warnings or errors when you execute `python manage.py runserver`.
"""
urlpatterns = [
    # Admin Site
    path('admin/', admin.site.urls),
    path('accounts/', include('django.contrib.auth.urls')),
    path('accounts/signup/', SignUpView.as_view()),
    # Wiki App
    path('', include('wiki.urls')),
]
예제 #22
0
from django.urls import path, include
from accounts.views import SignOutView, SignInView, UserProfileView, SignUpView

urlpatterns = (
    path('accounts/profile/',
         UserProfileView.as_view(),
         name='current user profile'),
    path('accounts/signin/', SignInView.as_view(), name='signin user'),
    path('accounts/profile/<int:pk>/',
         UserProfileView.as_view(),
         name='user profile'),
    path('accounts/signup/', SignUpView.as_view(), name='signup user'),
    path('accounts/signout/', SignOutView.as_view(), name='signout user'),
    path('accounts/', include('django.contrib.auth.urls')),
)

from .receivers import *
예제 #23
0
from django.urls import path, include
from project.views import TopicListView
from accounts.views import SignUpView


urlpatterns = [
    path('list_of_topics/', TopicListView.as_view(), name='accounts'),
    path('signup/', SignUpView.as_view(), name='templates-signup-page'),
    path('accounts/', include('django.contrib.auth.urls')),
]
예제 #24
0
from django.contrib import admin
from django.urls import path, include
from accounts.views import SignUpView
from django.contrib.auth import views as auth_views
from django.urls import reverse_lazy

urlpatterns = [
    path('signup', SignUpView.as_view(), name='signup-form'),
    # Inspiration for these URL patterns goes to Corey Schafer's video tutorial: https://youtu.be/-tyBEsHSv7w
    path('reset-password/',
         auth_views.PasswordResetView.as_view(
             template_name="accounts/password_reset.html"),
         name="password_reset"),
    path('reset-password/done/',
         auth_views.PasswordResetDoneView.as_view(
             template_name="accounts/password_reset_done.html"),
         name="password_reset_done"),
    path('reset-password-confirm/<uidb64/<token>/',
         auth_views.PasswordResetConfirmView.as_view(
             template_name="acccounts/password_reset_confirm.html"),
         name="password_reset_confirm"),
]
예제 #25
0
파일: urls.py 프로젝트: RoscaS/Django_blog
from django.urls import path, re_path
from django.contrib.auth import views as auth_views

from accounts.views import SignUpView
from accounts.forms import SignUpForm

urlpatterns = [
    path('signup/',
         SignUpView.as_view(template_name='accounts/signup.html'),
         name='signup'),
    path('login/',
         auth_views.LoginView.as_view(template_name='accounts/login.html'),
         name='login'),
    path('logout/', auth_views.LogoutView.as_view(), name='logout'),

    ########## FORGOTEN PASSWORD ##########
    path('reset/',
         auth_views.PasswordResetView.as_view(
             template_name='accounts/password_reset_form.html',
             email_template_name='accounts/password_reset_email.html',
             subject_template_name='accounts/password_reset_subject.txt'),
         name='password_reset'),
    path('reset/done/',
         auth_views.PasswordResetDoneView.as_view(
             template_name='accounts/password_reset_done.html'),
         name='password_reset_done'),
    re_path(
        r'reset/(?P<uidb64>[0-9A-Za-z_\-]+)/(?P<token>[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})/',
        auth_views.PasswordResetConfirmView.as_view(
            template_name='accounts/password_reset_confirm.html'),
        name='password_reset_confirm'),
예제 #26
0
# -*- coding: utf-8 -*-
from django.conf.urls import url
from django.contrib.auth import views as auth_views
from accounts.views import SignUpView, CheckUniqueView

urlpatterns = [
    url(r'^signup/$', SignUpView.as_view(), name='signup'),
    url(r'^login/$',
        auth_views.login, {'template_name': 'accounts/login.html'},
        name='login'),
    url(r'^logout/$', auth_views.logout, {'next_page': '/'}, name='logout'),
    url(r'^check_unique/$', CheckUniqueView.as_view(), name='check_unique'),
]
예제 #27
0
from django.urls import path
from accounts.views import SignUpView

urlpatterns = [path('signup/', SignUpView.as_view(), name='wiki-signup-page')]
예제 #28
0
from django.urls import path
from accounts.views import SignUpView

urlpatterns = [path('signup/', SignUpView.as_view(), name='signup')]
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()),
]
예제 #30
0
파일: urls.py 프로젝트: Mark-Seaman/BACS350
from django.contrib import admin
from django.urls import path

from accounts.views import AccountDeleteView, AccountDetailView, AccountListView, AccountCreateView, AccountUpdateView, SignUpView

urlpatterns = [

    # Account Views
    path('', AccountListView.as_view(), name='account_list'),
    path('<int:pk>', AccountDetailView.as_view(), name='account_detail'),
    path('add', AccountCreateView.as_view(), name='account_add'),
    path('<int:pk>/', AccountUpdateView.as_view(), name='account_edit'),
    path('<int:pk>/delete', AccountDeleteView.as_view(),
         name='account_delete'),

    # Sign Up
    path('signup/', SignUpView.as_view(), name='signup'),
]
예제 #31
0
from django.conf.urls import url
from accounts.views import SignUpView, SignInView, SignOutView

urlpatterns = [

    # user authentication urls
    url(r'^signup/$', SignUpView.as_view(), name="user_signup"),
    url(r'^signin/$', SignInView.as_view(), name="user_signin"),
    url(r'^signout/$', SignOutView.as_view(), name="user_signout"),
]