Merge pull request #3371 from alphagov/flask-login-again

Flask login (but backwards compatible)
This commit is contained in:
Chris Hill-Scott
2020-04-01 16:14:38 +01:00
committed by GitHub
6 changed files with 15 additions and 4 deletions

View File

@@ -531,6 +531,12 @@ def make_session_permanent():
when you first log in/sign up/get invited/etc, but we do it just to be safe. For more reading, check here:
https://stackoverflow.com/questions/34118093/flask-permanent-session-where-to-define-them
"""
# TODO: Remove this loop after a weekend, when all cookies have either run through this code or expired
for val in ['user_id', 'remember', 'remember_seconds']:
if val in session:
session[f'_{val}'] = session[val]
session.permanent = True

View File

@@ -139,6 +139,7 @@ class User(JSONModel, UserMixin):
def login(self):
login_user(self)
session['user_id'] = self.id
def sign_in(self):