@@ -17,7 +17,10 @@ import { useToastStore } from '../../../stores/toast';
1717
1818const { showToast } = useToastStore ();
1919
20- // 监听自定义登录路径,禁止特殊字符和空格
20+ // 系统保留路径列表,这些路径会与前端路由或后端 API 冲突
21+ const RESERVED_PATHS = [' settings' , ' login' , ' groups' , ' nodes' , ' subscriptions' , ' dashboard' , ' api' , ' explore' ];
22+
23+ // 监听自定义登录路径,禁止特殊字符、空格和保留路径
2124watch (() => props .settings .customLoginPath , (val ) => {
2225 if (! val) return ;
2326
@@ -27,6 +30,14 @@ watch(() => props.settings.customLoginPath, (val) => {
2730 if (sanitized !== val) {
2831 props .settings .customLoginPath = sanitized;
2932 showToast (' 路径仅允许字母、数字、下划线、中划线' , ' warning' );
33+ return ;
34+ }
35+
36+ // 检查是否为保留路径(去除前后斜杠后比较首段)
37+ const pathSegment = sanitized .replace (/ ^ \/ + / , ' ' ).split (' /' )[0 ].toLowerCase ();
38+ if (RESERVED_PATHS .includes (pathSegment)) {
39+ props .settings .customLoginPath = ' ' ;
40+ showToast (` "/${ pathSegment} " 是系统保留路径,不可用作自定义登录路径` , ' error' );
3041 }
3142});
3243
@@ -212,6 +223,9 @@ watch(() => props.settings.customLoginPath, (val) => {
212223 <p class =" text-xs text-gray-500 dark:text-gray-400 mt-1" >
213224 设置后,只有访问此路径才能进入登录页面。默认路径 <code >/login</code > 将失效(除非未设置)。
214225 </p >
226+ <p class =" text-xs text-amber-600 dark:text-amber-400 mt-1" >
227+ ⚠️ 不可使用系统保留路径:/settings, /login, /groups, /nodes, /subscriptions, /dashboard
228+ </p >
215229 </div >
216230
217231 <div v-show =" disguiseConfig.enabled"
0 commit comments