Merge pull request #3926 from alphagov/sign-in-bug

ensure user details are always in the session after entering password
This commit is contained in:
Leo Hemsted
2021-07-06 11:56:24 +01:00
committed by GitHub
3 changed files with 73 additions and 33 deletions

View File

@@ -142,20 +142,12 @@ class User(JSONModel, UserMixin):
login_user(self)
session['user_id'] = self.id
def sign_in(self):
session['user_details'] = {"email": self.email_address, "id": self.id}
if not self.is_active:
return False
def send_login_code(self):
if self.email_auth:
user_api_client.send_verify_code(self.id, 'email', None, request.args.get('next'))
if self.sms_auth:
user_api_client.send_verify_code(self.id, 'sms', self.mobile_number)
return True
def sign_out(self):
session.clear()
# Update the db so the server also knows the user is logged out.