parent
3b5b5757e3
commit
1009362d26
2 changed files with 19 additions and 0 deletions
|
@ -427,6 +427,10 @@ def validate_reset_code(code):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
user = code.user
|
user = code.user
|
||||||
|
if not user.verified:
|
||||||
|
user.verified = True
|
||||||
|
user.save()
|
||||||
|
|
||||||
code.delete_instance()
|
code.delete_instance()
|
||||||
|
|
||||||
return user
|
return user
|
||||||
|
|
|
@ -106,6 +106,21 @@ class WebEndpointTestCase(EndpointTestCase):
|
||||||
code = model.user.create_reset_password_email_code(user.email)
|
code = model.user.create_reset_password_email_code(user.email)
|
||||||
self.getResponse('web.confirm_recovery', code=code.code, expected_code=302)
|
self.getResponse('web.confirm_recovery', code=code.code, expected_code=302)
|
||||||
|
|
||||||
|
def test_confirm_recovery_verified(self):
|
||||||
|
# Create a valid code and try.
|
||||||
|
user = model.user.get_user('devtable')
|
||||||
|
user.verified = False
|
||||||
|
user.save()
|
||||||
|
|
||||||
|
code = model.user.create_reset_password_email_code(user.email)
|
||||||
|
self.getResponse('web.confirm_recovery', code=code.code, expected_code=302)
|
||||||
|
|
||||||
|
# Ensure the current user is the expected user and that they are verified.
|
||||||
|
user = model.user.get_user('devtable')
|
||||||
|
self.assertTrue(user.verified)
|
||||||
|
|
||||||
|
self.getResponse('web.receipt', expected_code=404) # Will 401 if no user.
|
||||||
|
|
||||||
def test_build_status_badge(self):
|
def test_build_status_badge(self):
|
||||||
# Try for an invalid repository.
|
# Try for an invalid repository.
|
||||||
self.getResponse('web.build_status_badge', repository='foo/bar', expected_code=404)
|
self.getResponse('web.build_status_badge', repository='foo/bar', expected_code=404)
|
||||||
|
|
Reference in a new issue