mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-20 14:29:51 -04:00
Merge pull request #3310 from alphagov/fix-reset-password
Fix reset password flow
This commit is contained in:
@@ -96,7 +96,7 @@ def log_in_user(user_id):
|
||||
session['current_session_id'] = user.current_session_id
|
||||
# Check if coming from new password page
|
||||
if 'password' in session.get('user_details', {}):
|
||||
user.update_password(session['user_details']['password'], from_email=True)
|
||||
user.update_password(session['user_details']['password'], validated_email_access=True)
|
||||
user.activate()
|
||||
user.login()
|
||||
finally:
|
||||
|
||||
@@ -106,8 +106,8 @@ class User(JSONModel, UserMixin):
|
||||
response = user_api_client.update_user_attribute(self.id, **kwargs)
|
||||
self.__init__(response)
|
||||
|
||||
def update_password(self, password, from_email=False):
|
||||
response = user_api_client.update_password(self.id, password, from_email=from_email)
|
||||
def update_password(self, password, validated_email_access=False):
|
||||
response = user_api_client.update_password(self.id, password, validated_email_access=validated_email_access)
|
||||
self.__init__(response)
|
||||
|
||||
def password_changed_more_recently_than(self, datetime_string):
|
||||
|
||||
@@ -75,10 +75,10 @@ class UserApiClient(NotifyAdminAPIClient):
|
||||
return user_data['data']
|
||||
|
||||
@cache.delete('user-{user_id}')
|
||||
def update_password(self, user_id, password, from_email=False):
|
||||
def update_password(self, user_id, password, validated_email_access=False):
|
||||
data = {"_password": password}
|
||||
if from_email:
|
||||
data["from_email"] = from_email
|
||||
if validated_email_access:
|
||||
data["validated_email_access"] = validated_email_access
|
||||
url = "/user/{}/update-password".format(user_id)
|
||||
user_data = self.post(url, data=data)
|
||||
return user_data['data']
|
||||
|
||||
Reference in New Issue
Block a user