mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2026-01-06 23:24:23 +08:00
fix: Modify session verification on the interface (#8213)
This commit is contained in:
parent
337dad2ca6
commit
7c8e233bb1
3 changed files with 16 additions and 19 deletions
|
|
@ -215,14 +215,10 @@ func Routers() *gin.Engine {
|
|||
}
|
||||
|
||||
Router.Use(middleware.OperationLog())
|
||||
Router.Use(middleware.PasswordExpired())
|
||||
if global.CONF.Base.IsDemo {
|
||||
Router.Use(middleware.DemoHandle())
|
||||
}
|
||||
Router.Use(middleware.JwtAuth())
|
||||
Router.Use(middleware.SessionAuth())
|
||||
Router.Use(middleware.PasswordExpired())
|
||||
Router.Use(middleware.GlobalLoading())
|
||||
Router.Use(Proxy())
|
||||
|
||||
PrivateGroup := Router.Group("/api/v2/core")
|
||||
PrivateGroup.Use(middleware.WhiteAllow())
|
||||
|
|
@ -232,6 +228,10 @@ func Routers() *gin.Engine {
|
|||
router.InitRouter(PrivateGroup)
|
||||
}
|
||||
|
||||
Router.Use(middleware.JwtAuth())
|
||||
Router.Use(middleware.SessionAuth())
|
||||
Router.Use(middleware.GlobalLoading())
|
||||
Router.Use(Proxy())
|
||||
Router.NoRoute(func(c *gin.Context) {
|
||||
if !checkBindDomain(c) {
|
||||
handleNoRoute(c, "err_domain")
|
||||
|
|
|
|||
|
|
@ -31,5 +31,8 @@ export namespace Login {
|
|||
isDemo: boolean;
|
||||
isIntl: boolean;
|
||||
language: string;
|
||||
menuTabs: string;
|
||||
panelName: string;
|
||||
theme: string;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -183,7 +183,6 @@ import { loginApi, getCaptcha, mfaLoginApi, getLoginSetting } from '@/api/module
|
|||
import { GlobalStore, MenuStore, TabsStore } from '@/store';
|
||||
import { MsgSuccess } from '@/utils/message';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { getSettingInfo } from '@/api/modules/setting';
|
||||
import { encryptPassword } from '@/utils/util';
|
||||
import { getXpackSettingForTheme } from '@/utils/xpack';
|
||||
|
||||
|
|
@ -393,18 +392,6 @@ const loginVerify = async () => {
|
|||
captcha.captchaLength = res.data.captchaLength ? res.data.captchaLength : 0;
|
||||
};
|
||||
|
||||
const loadDataFromDB = async () => {
|
||||
const res = await getSettingInfo();
|
||||
document.title = res.data.panelName;
|
||||
i18n.locale.value = res.data.language;
|
||||
i18n.warnHtmlMessage = false;
|
||||
globalStore.entrance = res.data.securityEntrance;
|
||||
globalStore.setOpenMenuTabs(res.data.menuTabs === 'Enable');
|
||||
globalStore.updateLanguage(res.data.language);
|
||||
let theme = globalStore.themeConfig.theme === res.data.theme ? res.data.theme : globalStore.themeConfig.theme;
|
||||
globalStore.setThemeConfig({ ...themeConfig.value, theme: theme, panelName: res.data.panelName });
|
||||
};
|
||||
|
||||
const getSetting = async () => {
|
||||
try {
|
||||
const res = await getLoginSetting();
|
||||
|
|
@ -413,13 +400,20 @@ const getSetting = async () => {
|
|||
handleCommand(loginForm.language);
|
||||
isIntl.value = res.data.isIntl;
|
||||
globalStore.isIntl = isIntl.value;
|
||||
|
||||
document.title = res.data.panelName;
|
||||
i18n.locale.value = res.data.language;
|
||||
i18n.warnHtmlMessage = false;
|
||||
globalStore.setOpenMenuTabs(res.data.menuTabs === 'Enable');
|
||||
globalStore.updateLanguage(res.data.language);
|
||||
let theme = globalStore.themeConfig.theme === res.data.theme ? res.data.theme : globalStore.themeConfig.theme;
|
||||
globalStore.setThemeConfig({ ...themeConfig.value, theme: theme, panelName: res.data.panelName });
|
||||
} catch (error) {}
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
globalStore.isOnRestart = false;
|
||||
getSetting();
|
||||
loadDataFromDB();
|
||||
getXpackSettingForTheme();
|
||||
if (!globalStore.ignoreCaptcha) {
|
||||
loginVerify();
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue