Esempio n. 1
0
    def test_resend_activation_mail_before_cooldown(self, mocked_send):
        mocked_send.return_value = True

        self.request.entree_user = self.user
        token = self.user.create_token(token_type=MAIL_TOKEN)

        verify_mail = b64encode(self.user.email)

        ViewClass = IdentityVerifyResend.as_view()
        response = ViewClass(self.request, token=token.value, email=verify_mail)

        assert_equals(response['Location'], reverse('verify_identity'))
Esempio n. 2
0
    def test_resend_activation_mail_before_cooldown(self, mocked_send):
        mocked_send.return_value = True

        self.request.entree_user = self.user
        token = self.user.create_token(token_type=MAIL_TOKEN)

        verify_mail = b64encode(self.user.email)

        ViewClass = IdentityVerifyResend.as_view()
        response = ViewClass(self.request,
                             token=token.value,
                             email=verify_mail)

        assert_equals(response['Location'], reverse('verify_identity'))
Esempio n. 3
0
    def test_resend_activation_mail_on_demand(self, mocked_send):
        mocked_send.return_value = True

        self.request.entree_user = self.user
        token = self.user.create_token(token_type=MAIL_TOKEN)
        token.touched = datetime.now() - timedelta(days=1)
        token.save()

        verify_mail = b64encode(self.user.email)

        ViewClass = IdentityVerifyResend.as_view()
        response = ViewClass(self.request, token=token.value, email=verify_mail)

        assert_equals(True, mocked_send.called)
        assert_equals(response['Location'], reverse('verify_identity'))
Esempio n. 4
0
    def test_resend_activation_mail_on_demand(self, mocked_send):
        mocked_send.return_value = True

        self.request.entree_user = self.user
        token = self.user.create_token(token_type=MAIL_TOKEN)
        token.touched = datetime.now() - timedelta(days=1)
        token.save()

        verify_mail = b64encode(self.user.email)

        ViewClass = IdentityVerifyResend.as_view()
        response = ViewClass(self.request,
                             token=token.value,
                             email=verify_mail)

        assert_equals(True, mocked_send.called)
        assert_equals(response['Location'], reverse('verify_identity'))
Esempio n. 5
0
    def test_resend_activation_mail_on_demand_ajax(self, mocked_send):

        self.request.is_ajax = lambda: True
        self.request.entree_user = self.user

        token = self.user.create_token(token_type=MAIL_TOKEN)
        token.touched = datetime.now() - timedelta(days=1)
        token.save()

        verify_mail = b64encode(self.user.email)

        ViewClass = IdentityVerifyResend.as_view()
        response = ViewClass(self.request, token=token.value, email=verify_mail)

        response = json.loads(response.content)

        assert_equals(dict(send_status=True), response)
        assert_equals(True, mocked_send.called)
Esempio n. 6
0
    def test_resend_activation_mail_on_demand_ajax(self, mocked_send):

        self.request.is_ajax = lambda: True
        self.request.entree_user = self.user

        token = self.user.create_token(token_type=MAIL_TOKEN)
        token.touched = datetime.now() - timedelta(days=1)
        token.save()

        verify_mail = b64encode(self.user.email)

        ViewClass = IdentityVerifyResend.as_view()
        response = ViewClass(self.request,
                             token=token.value,
                             email=verify_mail)

        response = json.loads(response.content)

        assert_equals(dict(send_status=True), response)
        assert_equals(True, mocked_send.called)
Esempio n. 7
0
    url(r'^login/recovery/(?P<origin_site>\d+)/$', RecoveryLoginView.as_view(), name='login-recovery'),

    url(r'^login/$', LoginView.as_view(), name='login'),  # dummy url
    url(r'^login/(?P<origin_site>\d+)/$', LoginView.as_view(), name='login'),
    url(r'^login/(?P<origin_site>\d+)/(?P<next_url>\S+)/$', LoginView.as_view(), name='login'),

    url(r'^logout/$', LogoutView.as_view(), name='logout'),  # dummy url
    url(r'^logout/(?P<origin_site>\d+)/$', LogoutView.as_view(), name='logout'),
    url(r'^logout/(?P<origin_site>\d+)/(?P<next_url>\S+)/$', LogoutView.as_view(), name='logout'),

    url(r'^register/$', CreateIdentityView.as_view(), name='register'),  # dummy url
    url(r'^register/(?P<origin_site>\d+)/$', CreateIdentityView.as_view(), name='register'),
    url(r'^register/(?P<origin_site>\d+)/(?P<next_url>\S+)/$', CreateIdentityView.as_view(), name='create_identity'),

    #each of these urls below should start w/ the same string
    #there's middleware which controls inactive account if: url.startswith(reverse('verify_identity'))
    url(r'^verify/$', IdentityVerifyView.as_view(), name='verify_identity'),
    url(r'^verify/(?P<email>[A-Za-z0-9=]+)/(?P<token>\w+)/$', IdentityVerifyView.as_view(), name='verify_identity'),

    url(r'^verify/resend/$', IdentityVerifyResend.as_view(), name='verify_resend'),
    # ^ each of these urls above should start w/ the same string

    url(r'^password-change/$', PasswordChangeView.as_view(), name='password_change'),
    url(r'^password-recovery/$', PasswordRecoveryRequestView.as_view(), name='password_recovery'),
    url(r'^password-recovery/finish/(?P<email>[A-Za-z0-9=]+)/(?P<token>\S+)/$', PasswordResetView.as_view(), name='recovery_finish'),
    url(r'^password-recovery/finish/$', FinishRecoveryView.as_view(), name='recovery_finish'),

    url(r'^$', LoginView.as_view(), name='homepage')
)
Esempio n. 8
0
        name='register'),  #dummy url
    url(r'^register/(?P<origin_site>\d+)/$',
        CreateIdentityView.as_view(),
        name='register'),
    url(r'^register/(?P<origin_site>\d+)/(?P<next_url>\S+)/$',
        CreateIdentityView.as_view(),
        name='create_identity'),

    #each of these urls below should start w/ the same string
    #there's middleware which controls inactive account if: url.startswith(reverse('verify_identity'))
    url(r'^verify/$', IdentityVerifyView.as_view(), name='verify_identity'),
    url(r'^verify/(?P<email>[A-Za-z0-9=]+)/(?P<token>\w+)/$',
        IdentityVerifyView.as_view(),
        name='verify_identity'),
    url(r'^verify/resend/$',
        IdentityVerifyResend.as_view(),
        name='verify_resend'),
    # ^ each of these urls above should start w/ the same string
    url(r'^password-change/$',
        PasswordChangeView.as_view(),
        name='password_change'),
    url(r'^password-recovery/$',
        PasswordRecoveryRequestView.as_view(),
        name='password_recovery'),
    url(r'^password-recovery/finish/(?P<email>[A-Za-z0-9=]+)/(?P<token>\S+)/$',
        PasswordResetView.as_view(),
        name='recovery_finish'),
    url(r'^password-recovery/finish/$',
        FinishRecoveryView.as_view(),
        name='recovery_finish'),
    url(r'^$', LoginView.as_view(), name='homepage'))