def test_password_change_form_valid_change_password(self): new_pwd = '%s_neasi' % self.user_password data = { 'old_password': self.user_password, 'password': new_pwd, 'password2': new_pwd, } self.request.method = 'POST' self.request.POST = data #create session auth = LoginView() auth.request = self.request auth.entree_login(self.user) ViewClass = csrf_exempt(PasswordChangeView.as_view()) ViewClass(self.request) assert_equals(True, self.user.check_password(new_pwd))
def test_password_change_anonymous_redirected_away(self): ViewClass = PasswordChangeView.as_view() res = ViewClass(self.request) assert_equals(res['Location'], reverse('login'))
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') )
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'))