Update dashboard.py

This commit is contained in:
Mr Chen 2024-12-01 21:45:16 +08:00
parent bad42e8e48
commit fde9da1af5
1 changed files with 8 additions and 0 deletions

View File

@ -39,12 +39,20 @@ def admin_safe_path(path):
if login != '':
import base64
import json
import time
try:
# print(login)
login_str = base64.b64decode(login)
login_str = login_str.decode('utf-8')
data = json.loads(login_str)
time_now = time.time() * 1000
time_diff = time_now - data['time']
if time_diff > 2000:
return redirect('/')
info = thisdb.getUserByName(data['username'])
if info is None:
return redirect('/')