Added a reset of failed_login_count when the user is activated.

Update user from the update-password api call (which resets the failed_login_count)
This commit is contained in:
Rebecca Law
2017-02-28 11:56:40 +00:00
parent b37e7fd188
commit 2d4e0a0631
2 changed files with 2 additions and 1 deletions

View File

@@ -31,7 +31,7 @@ def two_factor():
services = service_api_client.get_active_services({'user_id': str(user_id)}).get('data', [])
# Check if coming from new password page
if 'password' in session['user_details']:
user_api_client.update_password(user.id, password=session['user_details']['password'])
user = user_api_client.update_password(user.id, password=session['user_details']['password'])
if user.is_locked():
form.sms_code.errors.append('Code not found')
return render_template('views/two-factor.html', form=form)

View File

@@ -152,6 +152,7 @@ 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