Compare commits

..

3 Commits

Author SHA1 Message Date
key762
8291649432
Merge d6e0e43e1a into fdb13e8257 2025-02-07 11:36:25 +08:00
xiaoQQya
fdb13e8257
🐛 修复登录状态 /login 未自动跳转 (#58)
Some checks failed
Docker Publish / build-and-push (push) Has been cancelled
2025-02-07 10:29:47 +08:00
xiaoQQya
13244e1dcf
登录状态持久化,默认跳转任务列表 (#56)
* chore: 登录状态持久化,默认 31 天,可修改 PERMANENT_SESSION_LIFETIME 进行配置

* chore: 登录默认跳转页面修改为任务列表
2025-02-06 19:11:33 +08:00
2 changed files with 6 additions and 1 deletions

View File

@ -14,6 +14,7 @@ from flask import (
) )
from apscheduler.schedulers.background import BackgroundScheduler from apscheduler.schedulers.background import BackgroundScheduler
from apscheduler.triggers.cron import CronTrigger from apscheduler.triggers.cron import CronTrigger
from datetime import timedelta
import subprocess import subprocess
import requests import requests
import hashlib import hashlib
@ -53,6 +54,7 @@ app = Flask(__name__)
app.config["APP_VERSION"] = get_app_ver() app.config["APP_VERSION"] = get_app_ver()
app.secret_key = "ca943f6db6dd34823d36ab08d8d6f65d" app.secret_key = "ca943f6db6dd34823d36ab08d8d6f65d"
app.config["SESSION_COOKIE_NAME"] = "QUARK_AUTO_SAVE_SESSION" app.config["SESSION_COOKIE_NAME"] = "QUARK_AUTO_SAVE_SESSION"
app.config["PERMANENT_SESSION_LIFETIME"] = timedelta(days=31)
app.json.ensure_ascii = False app.json.ensure_ascii = False
app.json.sort_keys = False app.json.sort_keys = False
app.jinja_env.variable_start_string = "[[" app.jinja_env.variable_start_string = "[["
@ -121,11 +123,14 @@ def login():
): ):
logging.info(f">>> 用户 {username} 登录成功") logging.info(f">>> 用户 {username} 登录成功")
session["login"] = gen_md5(username + password) session["login"] = gen_md5(username + password)
session.permanent = True
return redirect(url_for("index")) return redirect(url_for("index"))
else: else:
logging.info(f">>> 用户 {username} 登录失败") logging.info(f">>> 用户 {username} 登录失败")
return render_template("login.html", message="登录失败") return render_template("login.html", message="登录失败")
if is_login():
return redirect(url_for("index"))
return render_template("login.html", error=None) return render_template("login.html", error=None)

View File

@ -440,7 +440,7 @@
lastSuggestionsTime: 0, lastSuggestionsTime: 0,
isSearching: false, isSearching: false,
}, },
activeTab: 'config', activeTab: 'tasklist',
}, },
filters: { filters: {
ts2date: function (value) { ts2date: function (value) {