Fix the user flow when the user account is locked.

The user has 10 tries at the password, after which the account is locked.
The same is true for the verify code, the user will have 10 tries before the user account is locked.
This commit is contained in:
Rebecca Law
2017-02-28 14:41:31 +00:00
parent 2d4e0a0631
commit 35f61125e8
6 changed files with 14 additions and 5 deletions

View File

@@ -75,6 +75,11 @@ class UserApiClient(NotifyAdminAPIClient):
user_data = self.post(url, data=data)
return User(user_data['data'], max_failed_login_count=self.max_failed_login_count)
def reset_failed_login_count(self, user_id):
url = "/user/{}/reset-failed-login-count".format(user_id)
user_data = self.post(url, data={})
return User(user_data['data'], max_failed_login_count=self.max_failed_login_count)
def update_password(self, user_id, password):
data = {"_password": password}
url = "/user/{}/update-password".format(user_id)
@@ -152,7 +157,6 @@ class UserApiClient(NotifyAdminAPIClient):
def activate_user(self, user):
if user.state == 'pending':
user.state = 'active'
user._failed_login_count = 0
return self.update_user(user)
else:
return user