From de75386944657be2d486ae79afdb69b01144667e Mon Sep 17 00:00:00 2001 From: Soulter <905617992@qq.com> Date: Tue, 18 Mar 2025 22:41:33 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=88=20perf:=20=E7=99=BB=E5=BD=95?= =?UTF-8?q?=E5=90=8E=E6=A3=80=E6=9F=A5=E9=BB=98=E8=AE=A4=E5=AF=86=E7=A0=81?= =?UTF-8?q?=E5=92=8C=E5=BC=B9=E5=87=BA=E4=BF=AE=E6=94=B9=E8=AD=A6=E5=91=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- astrbot/dashboard/routes/auth.py | 14 +++++++++++++- .../full/vertical-header/VerticalHeader.vue | 14 ++++++++++++++ dashboard/src/stores/auth.ts | 1 + 3 files changed, 28 insertions(+), 1 deletion(-) diff --git a/astrbot/dashboard/routes/auth.py b/astrbot/dashboard/routes/auth.py index 2e525a3c..34ba8fd3 100644 --- a/astrbot/dashboard/routes/auth.py +++ b/astrbot/dashboard/routes/auth.py @@ -3,6 +3,7 @@ import datetime from .route import Route, Response, RouteContext from quart import request from astrbot.core import WEBUI_SK +from astrbot import logger class AuthRoute(Route): @@ -19,9 +20,20 @@ class AuthRoute(Route): password = self.config["dashboard"]["password"] post_data = await request.json if post_data["username"] == username and post_data["password"] == password: + change_pwd_hint = False + if username == "astrbot" and password == "77b90590a8945a7d36c963981a307dc9": + change_pwd_hint = True + logger.warning("为了保证安全,请尽快修改默认密码。") + return ( Response() - .ok({"token": self.generate_jwt(username), "username": username}) + .ok( + { + "token": self.generate_jwt(username), + "username": username, + "change_pwd_hint": change_pwd_hint, + } + ) .__dict__ ) else: diff --git a/dashboard/src/layouts/full/vertical-header/VerticalHeader.vue b/dashboard/src/layouts/full/vertical-header/VerticalHeader.vue index 68e6d38e..3d08c9cd 100644 --- a/dashboard/src/layouts/full/vertical-header/VerticalHeader.vue +++ b/dashboard/src/layouts/full/vertical-header/VerticalHeader.vue @@ -8,6 +8,7 @@ import { useCommonStore } from '@/stores/common'; const customizer = useCustomizerStore(); let dialog = ref(false); +let accountWarning = ref(false) let updateStatusDialog = ref(false); let password = ref(''); let newPassword = ref(''); @@ -177,6 +178,14 @@ checkUpdate(); const commonStore = useCommonStore(); commonStore.createWebSocket(); commonStore.getStartTime(); + + +if (localStorage.getItem('change_pwd_hint') != null && localStorage.getItem('change_pwd_hint') == 'true') { + dialog.value = true; + accountWarning.value = true; + localStorage.removeItem('change_pwd_hint'); +} +