mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-02-13 03:50:07 +08:00
feat(system): Optimize the logic of the login page (#7828)
This commit is contained in:
parent
368203443f
commit
8c2bb231c6
@ -18,7 +18,7 @@ func (b *BaseApi) SearchAppLauncher(c *gin.Context) {
|
|||||||
// @Tags App Launcher
|
// @Tags App Launcher
|
||||||
// @Summary Update app Launcher
|
// @Summary Update app Launcher
|
||||||
// @Accept json
|
// @Accept json
|
||||||
// @Param request body dto.ChangeShow true "request"
|
// @Param request body dto.SettingUpdate true "request"
|
||||||
// @Success 200
|
// @Success 200
|
||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @Security Timestamp
|
// @Security Timestamp
|
||||||
|
@ -6,7 +6,6 @@ import (
|
|||||||
"github.com/1Panel-dev/1Panel/core/app/dto"
|
"github.com/1Panel-dev/1Panel/core/app/dto"
|
||||||
"github.com/1Panel-dev/1Panel/core/app/model"
|
"github.com/1Panel-dev/1Panel/core/app/model"
|
||||||
"github.com/1Panel-dev/1Panel/core/constant"
|
"github.com/1Panel-dev/1Panel/core/constant"
|
||||||
"github.com/1Panel-dev/1Panel/core/global"
|
|
||||||
"github.com/1Panel-dev/1Panel/core/utils/captcha"
|
"github.com/1Panel-dev/1Panel/core/utils/captcha"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
)
|
)
|
||||||
@ -119,24 +118,16 @@ func (b *BaseApi) GetResponsePage(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// @Tags Auth
|
// @Tags Auth
|
||||||
// @Summary Check System isDemo
|
// @Summary Get Setting For Login
|
||||||
// @Success 200 {boolean} demo
|
// @Success 200 {object} dto.SystemSetting
|
||||||
// @Router /core/auth/demo [get]
|
// @Router /core/auth/setting [get]
|
||||||
func (b *BaseApi) CheckIsDemo(c *gin.Context) {
|
func (b *BaseApi) GetLoginSetting(c *gin.Context) {
|
||||||
helper.SuccessWithData(c, global.CONF.Base.IsDemo)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Auth
|
|
||||||
// @Summary Load System Language
|
|
||||||
// @Success 200 {string} language
|
|
||||||
// @Router /core/auth/language [get]
|
|
||||||
func (b *BaseApi) GetLanguage(c *gin.Context) {
|
|
||||||
settingInfo, err := settingService.GetSettingInfo()
|
settingInfo, err := settingService.GetSettingInfo()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
helper.InternalServer(c, err)
|
helper.InternalServer(c, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
helper.SuccessWithData(c, settingInfo.Language)
|
helper.SuccessWithData(c, settingInfo)
|
||||||
}
|
}
|
||||||
|
|
||||||
func saveLoginLogs(c *gin.Context, err error) {
|
func saveLoginLogs(c *gin.Context, err error) {
|
||||||
@ -151,11 +142,3 @@ func saveLoginLogs(c *gin.Context, err error) {
|
|||||||
logs.Agent = c.GetHeader("User-Agent")
|
logs.Agent = c.GetHeader("User-Agent")
|
||||||
_ = logService.CreateLoginLog(logs)
|
_ = logService.CreateLoginLog(logs)
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Tags Auth
|
|
||||||
// @Summary Check System IsIntl
|
|
||||||
// @Success 200 {string} intl
|
|
||||||
// @Router /auth/intl [get]
|
|
||||||
func (b *BaseApi) CheckIsIntl(c *gin.Context) {
|
|
||||||
helper.SuccessWithData(c, global.CONF.Base.IsIntl)
|
|
||||||
}
|
|
||||||
|
@ -75,7 +75,7 @@ func (b *BaseApi) ListBuckets(c *gin.Context) {
|
|||||||
// @Tags Backup Account
|
// @Tags Backup Account
|
||||||
// @Summary Load backup account base info
|
// @Summary Load backup account base info
|
||||||
// @Accept json
|
// @Accept json
|
||||||
// @Success 200 {object} dto.OneDriveInfo
|
// @Success 200 {object} dto.BackupClientInfo
|
||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @Security Timestamp
|
// @Security Timestamp
|
||||||
// @Router /core/backups/client/:clientType [get]
|
// @Router /core/backups/client/:clientType [get]
|
||||||
|
@ -38,3 +38,9 @@ type MFALogin struct {
|
|||||||
Code string `json:"code" validate:"required"`
|
Code string `json:"code" validate:"required"`
|
||||||
AuthMethod string `json:"authMethod"`
|
AuthMethod string `json:"authMethod"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type SystemSetting struct {
|
||||||
|
IsDemo bool `json:"isDemo"`
|
||||||
|
Language string `json:"language"`
|
||||||
|
IsIntl bool `json:"isIntl"`
|
||||||
|
}
|
||||||
|
@ -18,7 +18,6 @@ import (
|
|||||||
type AuthService struct{}
|
type AuthService struct{}
|
||||||
|
|
||||||
type IAuthService interface {
|
type IAuthService interface {
|
||||||
CheckIsSafety(code string) (string, error)
|
|
||||||
GetResponsePage() (string, error)
|
GetResponsePage() (string, error)
|
||||||
VerifyCode(code string) (bool, error)
|
VerifyCode(code string) (bool, error)
|
||||||
Login(c *gin.Context, info dto.Login, entrance string) (*dto.UserLoginInfo, string, error)
|
Login(c *gin.Context, info dto.Login, entrance string) (*dto.UserLoginInfo, string, error)
|
||||||
@ -169,20 +168,6 @@ func (u *AuthService) VerifyCode(code string) (bool, error) {
|
|||||||
return hmac.Equal([]byte(setting.Value), []byte(code)), nil
|
return hmac.Equal([]byte(setting.Value), []byte(code)), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (u *AuthService) CheckIsSafety(code string) (string, error) {
|
|
||||||
status, err := settingRepo.Get(repo.WithByKey("SecurityEntrance"))
|
|
||||||
if err != nil {
|
|
||||||
return "", err
|
|
||||||
}
|
|
||||||
if len(status.Value) == 0 {
|
|
||||||
return "disable", nil
|
|
||||||
}
|
|
||||||
if status.Value == code {
|
|
||||||
return "pass", nil
|
|
||||||
}
|
|
||||||
return "unpass", nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (u *AuthService) GetResponsePage() (string, error) {
|
func (u *AuthService) GetResponsePage() (string, error) {
|
||||||
pageCode, err := settingRepo.Get(repo.WithByKey("NoAuthSetting"))
|
pageCode, err := settingRepo.Get(repo.WithByKey("NoAuthSetting"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -47,8 +47,9 @@ type ISettingService interface {
|
|||||||
UpdateTerminal(req dto.TerminalInfo) error
|
UpdateTerminal(req dto.TerminalInfo) error
|
||||||
|
|
||||||
UpdateSystemSSL() error
|
UpdateSystemSSL() error
|
||||||
|
|
||||||
GenerateRSAKey() error
|
GenerateRSAKey() error
|
||||||
|
|
||||||
|
GetLoginSetting() (*dto.SystemSetting, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewISettingService() ISettingService {
|
func NewISettingService() ISettingService {
|
||||||
@ -527,3 +528,16 @@ func (u *SettingService) GenerateRSAKey() error {
|
|||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (u *SettingService) GetLoginSetting() (*dto.SystemSetting, error) {
|
||||||
|
settingInfo, err := u.GetSettingInfo()
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
res := &dto.SystemSetting{
|
||||||
|
Language: settingInfo.Language,
|
||||||
|
IsDemo: global.CONF.Base.IsDemo,
|
||||||
|
IsIntl: global.CONF.Base.IsIntl,
|
||||||
|
}
|
||||||
|
return res, nil
|
||||||
|
}
|
||||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -28,7 +28,7 @@ func TestGenerateSwaggerDoc(t *testing.T) {
|
|||||||
fmt.Printf("generate swagger doc of agent failed, std1: %v, err: %v", string(std1), err)
|
fmt.Printf("generate swagger doc of agent failed, std1: %v, err: %v", string(std1), err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
cmd2 := exec.Command(swagBin, "init", "-o", workDir+"/cmd/server/docs/docs_core", "-d", workDir+"/core", "-g", "../cmd/server/main.go")
|
cmd2 := exec.Command(swagBin, "init", "-o", workDir+"/cmd/server/docs/docs_core", "-d", workDir+"/core", "-g", "./cmd/server/main.go")
|
||||||
cmd2.Dir = workDir
|
cmd2.Dir = workDir
|
||||||
std2, err := cmd2.CombinedOutput()
|
std2, err := cmd2.CombinedOutput()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -106,7 +106,7 @@ func TestGenerateSwaggerDoc(t *testing.T) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
docTemplate := strings.ReplaceAll(loadDefaultDocs(), "const docTemplate = \"aa\"", fmt.Sprintf("const docTemplate = `%s`", string(newJson)))
|
docTemplate := strings.ReplaceAll(loadDefaultDocs(), "const docTemplate = \"aa\"", fmt.Sprintf("const docTemplate = `%s`", string(newJson)))
|
||||||
if err := os.WriteFile(workDir+"/cmd/server/docs/docs.go", []byte(docTemplate), 0640); err != nil {
|
if err := os.WriteFile(workDir+"/core/cmd/server/docs/docs.go", []byte(docTemplate), 0640); err != nil {
|
||||||
fmt.Printf("write new docs.go failed, err: %v", err)
|
fmt.Printf("write new docs.go failed, err: %v", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -15,8 +15,6 @@ func (s *BaseRouter) InitRouter(Router *gin.RouterGroup) {
|
|||||||
baseRouter.POST("/mfalogin", baseApi.MFALogin)
|
baseRouter.POST("/mfalogin", baseApi.MFALogin)
|
||||||
baseRouter.POST("/login", baseApi.Login)
|
baseRouter.POST("/login", baseApi.Login)
|
||||||
baseRouter.POST("/logout", baseApi.LogOut)
|
baseRouter.POST("/logout", baseApi.LogOut)
|
||||||
baseRouter.GET("/demo", baseApi.CheckIsDemo)
|
baseRouter.GET("/setting", baseApi.GetLoginSetting)
|
||||||
baseRouter.GET("/language", baseApi.GetLanguage)
|
|
||||||
baseRouter.GET("/intl", baseApi.CheckIsIntl)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,4 +26,10 @@ export namespace Login {
|
|||||||
export interface ResAuthButtons {
|
export interface ResAuthButtons {
|
||||||
[propName: string]: any;
|
[propName: string]: any;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface LoginSetting {
|
||||||
|
isDemo: boolean;
|
||||||
|
isIntl: boolean;
|
||||||
|
language: string;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,18 +17,6 @@ export const logOutApi = () => {
|
|||||||
return http.post<any>(`/core/auth/logout`);
|
return http.post<any>(`/core/auth/logout`);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const checkIsSafety = (code: string) => {
|
export const getLoginSetting = () => {
|
||||||
return http.get<string>(`/core/auth/issafety?code=${code}`);
|
return http.get<Login.LoginSetting>('/core/auth/setting');
|
||||||
};
|
|
||||||
|
|
||||||
export const checkIsDemo = () => {
|
|
||||||
return http.get<boolean>('/core/auth/demo');
|
|
||||||
};
|
|
||||||
|
|
||||||
export const getLanguage = () => {
|
|
||||||
return http.get<string>(`/core/auth/language`);
|
|
||||||
};
|
|
||||||
|
|
||||||
export const checkIsIntl = () => {
|
|
||||||
return http.get<boolean>('/core/auth/intl');
|
|
||||||
};
|
};
|
||||||
|
@ -72,7 +72,7 @@ import Logo from './components/Logo.vue';
|
|||||||
import Collapse from './components/Collapse.vue';
|
import Collapse from './components/Collapse.vue';
|
||||||
import SubItem from './components/SubItem.vue';
|
import SubItem from './components/SubItem.vue';
|
||||||
import router, { menuList } from '@/routers/router';
|
import router, { menuList } from '@/routers/router';
|
||||||
import { checkIsIntl, logOutApi } from '@/api/modules/auth';
|
import { logOutApi } from '@/api/modules/auth';
|
||||||
import i18n from '@/lang';
|
import i18n from '@/lang';
|
||||||
import { DropdownInstance, ElMessageBox } from 'element-plus';
|
import { DropdownInstance, ElMessageBox } from 'element-plus';
|
||||||
import { GlobalStore, MenuStore } from '@/store';
|
import { GlobalStore, MenuStore } from '@/store';
|
||||||
@ -222,7 +222,6 @@ function getCheckedLabels(json: Node): string[] {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const search = async () => {
|
const search = async () => {
|
||||||
await checkIsSystemIntl();
|
|
||||||
let checkedLabels: any[] = [];
|
let checkedLabels: any[] = [];
|
||||||
const res = await getSettingInfo();
|
const res = await getSettingInfo();
|
||||||
version.value = res.data.systemVersion;
|
version.value = res.data.systemVersion;
|
||||||
@ -284,11 +283,6 @@ const openTask = () => {
|
|||||||
emit('openTask');
|
emit('openTask');
|
||||||
};
|
};
|
||||||
|
|
||||||
const checkIsSystemIntl = async () => {
|
|
||||||
const res = await checkIsIntl();
|
|
||||||
globalStore.isIntl = res.data;
|
|
||||||
};
|
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
menuStore.setMenuList(menuList);
|
menuStore.setMenuList(menuList);
|
||||||
search();
|
search();
|
||||||
|
@ -106,7 +106,7 @@
|
|||||||
@click="loginVerify()"
|
@click="loginVerify()"
|
||||||
/>
|
/>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="24" class="h-1">
|
<el-col :span="24" class="h-0.5">
|
||||||
<span v-show="errCaptcha" class="input-error">
|
<span v-show="errCaptcha" class="input-error">
|
||||||
{{ $t('commons.login.errorCaptcha') }}
|
{{ $t('commons.login.errorCaptcha') }}
|
||||||
</span>
|
</span>
|
||||||
@ -115,7 +115,6 @@
|
|||||||
</span>
|
</span>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button
|
<el-button
|
||||||
@click="login(loginFormRef)"
|
@click="login(loginFormRef)"
|
||||||
@ -128,32 +127,27 @@
|
|||||||
{{ $t('commons.button.login') }}
|
{{ $t('commons.button.login') }}
|
||||||
</el-button>
|
</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<el-text v-if="isDemo" type="danger">
|
||||||
<template v-if="!isIntl">
|
{{ $t('commons.login.username') }}:demo {{ $t('commons.login.password') }}:1panel
|
||||||
<el-form-item prop="agreeLicense">
|
</el-text>
|
||||||
<el-checkbox v-model="loginForm.agreeLicense">
|
<el-form-item prop="agreeLicense" v-if="!isIntl">
|
||||||
<template #default>
|
<el-checkbox v-model="loginForm.agreeLicense">
|
||||||
<span>
|
<template #default>
|
||||||
{{ $t('commons.button.agree') }}
|
<span>
|
||||||
<a
|
{{ $t('commons.button.agree') }}
|
||||||
class="agree"
|
<a
|
||||||
href="https://www.fit2cloud.com/legal/licenses.html"
|
class="agree"
|
||||||
target="_blank"
|
href="https://www.fit2cloud.com/legal/licenses.html"
|
||||||
>
|
target="_blank"
|
||||||
{{ $t('commons.login.licenseHelper') }}
|
>
|
||||||
</a>
|
{{ $t('commons.login.licenseHelper') }}
|
||||||
</span>
|
</a>
|
||||||
</template>
|
</span>
|
||||||
</el-checkbox>
|
</template>
|
||||||
</el-form-item>
|
</el-checkbox>
|
||||||
</template>
|
</el-form-item>
|
||||||
</div>
|
</div>
|
||||||
</el-form>
|
</el-form>
|
||||||
<div class="demo">
|
|
||||||
<span v-if="isDemo">
|
|
||||||
{{ $t('commons.login.username') }}:demo {{ $t('commons.login.password') }}:1panel
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<DialogPro v-model="open" center size="w-90">
|
<DialogPro v-model="open" center size="w-90">
|
||||||
@ -184,7 +178,7 @@
|
|||||||
import { ref, reactive, onMounted, computed } from 'vue';
|
import { ref, reactive, onMounted, computed } from 'vue';
|
||||||
import { useRouter } from 'vue-router';
|
import { useRouter } from 'vue-router';
|
||||||
import type { ElForm } from 'element-plus';
|
import type { ElForm } from 'element-plus';
|
||||||
import { loginApi, getCaptcha, mfaLoginApi, checkIsDemo, getLanguage, checkIsIntl } from '@/api/modules/auth';
|
import { loginApi, getCaptcha, mfaLoginApi, getLoginSetting } from '@/api/modules/auth';
|
||||||
import { GlobalStore, MenuStore, TabsStore } from '@/store';
|
import { GlobalStore, MenuStore, TabsStore } from '@/store';
|
||||||
import { MsgSuccess } from '@/utils/message';
|
import { MsgSuccess } from '@/utils/message';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
@ -270,12 +264,6 @@ const mfaShow = ref<boolean>(false);
|
|||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const dropdownText = ref('中文(简体)');
|
const dropdownText = ref('中文(简体)');
|
||||||
|
|
||||||
const checkIsSystemIntl = async () => {
|
|
||||||
const res = await checkIsIntl();
|
|
||||||
isIntl.value = res.data;
|
|
||||||
globalStore.isIntl = isIntl.value;
|
|
||||||
};
|
|
||||||
|
|
||||||
function handleCommand(command: string) {
|
function handleCommand(command: string) {
|
||||||
loginForm.language = command;
|
loginForm.language = command;
|
||||||
usei18n.locale.value = command;
|
usei18n.locale.value = command;
|
||||||
@ -284,8 +272,14 @@ function handleCommand(command: string) {
|
|||||||
dropdownText.value = '中文(简体)';
|
dropdownText.value = '中文(简体)';
|
||||||
} else if (command === 'en') {
|
} else if (command === 'en') {
|
||||||
dropdownText.value = 'English';
|
dropdownText.value = 'English';
|
||||||
|
} else if (command === 'pt-BR') {
|
||||||
|
dropdownText.value = 'Português (Brasil)';
|
||||||
} else if (command === 'tw') {
|
} else if (command === 'tw') {
|
||||||
dropdownText.value = '中文(繁體)';
|
dropdownText.value = '中文(繁體)';
|
||||||
|
} else if (command === 'ko') {
|
||||||
|
dropdownText.value = '한국어';
|
||||||
|
} else if (command === 'ja') {
|
||||||
|
dropdownText.value = '日本語';
|
||||||
} else if (command === 'ru') {
|
} else if (command === 'ru') {
|
||||||
dropdownText.value = 'Русский';
|
dropdownText.value = 'Русский';
|
||||||
} else if (command === 'ms') {
|
} else if (command === 'ms') {
|
||||||
@ -395,19 +389,6 @@ const loginVerify = async () => {
|
|||||||
captcha.captchaLength = res.data.captchaLength ? res.data.captchaLength : 0;
|
captcha.captchaLength = res.data.captchaLength ? res.data.captchaLength : 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
const checkIsSystemDemo = async () => {
|
|
||||||
const res = await checkIsDemo();
|
|
||||||
isDemo.value = res.data;
|
|
||||||
};
|
|
||||||
|
|
||||||
const loadLanguage = async () => {
|
|
||||||
try {
|
|
||||||
const res = await getLanguage();
|
|
||||||
loginForm.language = res.data;
|
|
||||||
handleCommand(res.data);
|
|
||||||
} catch (error) {}
|
|
||||||
};
|
|
||||||
|
|
||||||
const loadDataFromDB = async () => {
|
const loadDataFromDB = async () => {
|
||||||
const res = await getSettingInfo();
|
const res = await getSettingInfo();
|
||||||
document.title = res.data.panelName;
|
document.title = res.data.panelName;
|
||||||
@ -420,14 +401,25 @@ const loadDataFromDB = async () => {
|
|||||||
globalStore.setThemeConfig({ ...themeConfig.value, theme: theme, panelName: res.data.panelName });
|
globalStore.setThemeConfig({ ...themeConfig.value, theme: theme, panelName: res.data.panelName });
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const getSetting = async () => {
|
||||||
|
try {
|
||||||
|
const res = await getLoginSetting();
|
||||||
|
isDemo.value = res.data.isDemo;
|
||||||
|
loginForm.language = res.data.language;
|
||||||
|
handleCommand(loginForm.language);
|
||||||
|
isIntl.value = res.data.isIntl;
|
||||||
|
globalStore.isIntl = isIntl.value;
|
||||||
|
} catch (error) {}
|
||||||
|
};
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
globalStore.isOnRestart = false;
|
globalStore.isOnRestart = false;
|
||||||
checkIsSystemIntl();
|
getSetting();
|
||||||
loginVerify();
|
if (!globalStore.ignoreCaptcha) {
|
||||||
loadLanguage();
|
loginVerify();
|
||||||
|
}
|
||||||
document.title = globalStore.themeConfig.panelName;
|
document.title = globalStore.themeConfig.panelName;
|
||||||
loginForm.agreeLicense = globalStore.agreeLicense;
|
loginForm.agreeLicense = globalStore.agreeLicense;
|
||||||
checkIsSystemDemo();
|
|
||||||
document.onkeydown = (e: any) => {
|
document.onkeydown = (e: any) => {
|
||||||
e = window.event || e;
|
e = window.event || e;
|
||||||
if (e.keyCode === 13) {
|
if (e.keyCode === 13) {
|
||||||
|
@ -22,15 +22,11 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts" name="login">
|
<script setup lang="ts" name="login">
|
||||||
import { checkIsSafety } from '@/api/modules/auth';
|
|
||||||
import LoginForm from './components/login-form.vue';
|
import LoginForm from './components/login-form.vue';
|
||||||
import { ref, onMounted } from 'vue';
|
import { ref, onMounted } from 'vue';
|
||||||
import router from '@/routers';
|
|
||||||
import { GlobalStore } from '@/store';
|
import { GlobalStore } from '@/store';
|
||||||
import { getXpackSettingForTheme } from '@/utils/xpack';
|
|
||||||
|
|
||||||
const gStore = GlobalStore();
|
const gStore = GlobalStore();
|
||||||
const loading = ref();
|
|
||||||
const backgroundOpacity = ref(0.8);
|
const backgroundOpacity = ref(0.8);
|
||||||
const backgroundImage = ref(new URL('', import.meta.url).href);
|
const backgroundImage = ref(new URL('', import.meta.url).href);
|
||||||
const logoImage = ref(new URL('@/assets/images/1panel-login.png', import.meta.url).href);
|
const logoImage = ref(new URL('@/assets/images/1panel-login.png', import.meta.url).href);
|
||||||
@ -49,19 +45,6 @@ const getStatus = async () => {
|
|||||||
if (code != '') {
|
if (code != '') {
|
||||||
gStore.entrance = code;
|
gStore.entrance = code;
|
||||||
}
|
}
|
||||||
loading.value = true;
|
|
||||||
await checkIsSafety(gStore.entrance)
|
|
||||||
.then((res) => {
|
|
||||||
loading.value = false;
|
|
||||||
if (res.data === 'unpass') {
|
|
||||||
router.replace({ name: 'entrance', params: { code: gStore.entrance } });
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
getXpackSettingForTheme();
|
|
||||||
})
|
|
||||||
.catch(() => {
|
|
||||||
loading.value = false;
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user