David Ko commited on
Commit
ac9962b
ยท
1 Parent(s): 2937552

Enforce 2-minute session expiry: set PERMANENT_SESSION_LIFETIME=120s via timedelta and disable remember-login

Browse files
Files changed (1) hide show
  1. api.py +1 -2
api.py CHANGED
@@ -66,7 +66,6 @@ app.config['SESSION_TYPE'] = 'filesystem'
66
  app.config['SESSION_PERMANENT'] = True
67
  app.config['SESSION_USE_SIGNER'] = True
68
  app.config['SESSION_FILE_DIR'] = session_dir
69
- app.config['PERMANENT_SESSION_LIFETIME'] = timedelta(days=7) # ์„ธ์…˜ ์œ ํšจ ๊ธฐ๊ฐ„ ์„ค์ •
70
  print(f"Using session directory: {session_dir}")
71
  Session(app)
72
 
@@ -1176,7 +1175,7 @@ def login():
1176
  if username in users and users[username].password == password:
1177
  # ๋กœ๊ทธ์ธ ์„ฑ๊ณต ์‹œ ์„ธ์…˜์— ์‚ฌ์šฉ์ž ์ •๋ณด ์ €์žฅ
1178
  user = users[username]
1179
- login_user(user, remember=True, duration=timedelta(days=7)) # remember me ๊ธฐ๋Šฅ ํ™œ์„ฑํ™” ๋ฐ ๊ธฐ๊ฐ„ ์„ค์ •
1180
  session['user_id'] = user.id
1181
  session['username'] = username
1182
  session.permanent = True
 
66
  app.config['SESSION_PERMANENT'] = True
67
  app.config['SESSION_USE_SIGNER'] = True
68
  app.config['SESSION_FILE_DIR'] = session_dir
 
69
  print(f"Using session directory: {session_dir}")
70
  Session(app)
71
 
 
1175
  if username in users and users[username].password == password:
1176
  # ๋กœ๊ทธ์ธ ์„ฑ๊ณต ์‹œ ์„ธ์…˜์— ์‚ฌ์šฉ์ž ์ •๋ณด ์ €์žฅ
1177
  user = users[username]
1178
+ login_user(user, remember=False) # 2๋ถ„ ์„ธ์…˜ ๋งŒ๋ฃŒ๋ฅผ ์œ„ํ•ด remember ๋น„ํ™œ์„ฑํ™”
1179
  session['user_id'] = user.id
1180
  session['username'] = username
1181
  session.permanent = True