mirror of https://github.com/1Panel-dev/1Panel
fix: 面板设置样式调整 (#810)
parent
b42cf32326
commit
8947e00302
|
@ -29,7 +29,8 @@ func PasswordExpired() gin.HandlerFunc {
|
|||
helper.ErrorWithDetail(c, constant.CodePasswordExpired, constant.ErrTypePasswordExpired, err)
|
||||
return
|
||||
}
|
||||
expiredTime, err := time.Parse("2006-01-02 15:04:05", extime.Value)
|
||||
loc, _ := time.LoadLocation("Asia/Shanghai")
|
||||
expiredTime, err := time.ParseInLocation("2006-01-02 15:04:05", extime.Value, loc)
|
||||
if err != nil {
|
||||
helper.ErrorWithDetail(c, constant.CodePasswordExpired, constant.ErrTypePasswordExpired, err)
|
||||
return
|
||||
|
|
|
@ -20,14 +20,14 @@
|
|||
<el-input type="password" show-password clearable v-model="passForm.oldPassword" />
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
v-if="settingForm.complexityVerification === 'disable'"
|
||||
v-if="settingForm?.complexityVerification === 'disable'"
|
||||
:label="$t('setting.newPassword')"
|
||||
prop="newPassword"
|
||||
>
|
||||
<el-input type="password" show-password clearable v-model="passForm.newPassword" />
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
v-if="settingForm.complexityVerification === 'enable'"
|
||||
v-if="settingForm?.complexityVerification === 'enable'"
|
||||
:label="$t('setting.newPassword')"
|
||||
prop="newPasswordComplexity"
|
||||
>
|
||||
|
@ -55,37 +55,14 @@
|
|||
|
||||
<script setup lang="ts">
|
||||
import { ref, onMounted, reactive } from 'vue';
|
||||
import { Setting } from '@/api/interface/setting';
|
||||
import { getSettingInfo, handleExpired } from '@/api/modules/setting';
|
||||
import { ElForm } from 'element-plus';
|
||||
import i18n from '@/lang';
|
||||
import { Rules } from '@/global/form-rules';
|
||||
import router from '@/routers';
|
||||
import { MsgError, MsgSuccess } from '@/utils/message';
|
||||
let settingForm = reactive<Setting.SettingInfo>({
|
||||
userName: '',
|
||||
password: '',
|
||||
email: '',
|
||||
sessionTimeout: 86400,
|
||||
localTime: '',
|
||||
panelName: '',
|
||||
theme: '',
|
||||
language: '',
|
||||
serverPort: 8888,
|
||||
securityEntrance: '',
|
||||
systemVersion: '',
|
||||
expirationDays: 0,
|
||||
expirationTime: '',
|
||||
complexityVerification: 'enable',
|
||||
mfaStatus: '',
|
||||
mfaSecret: '',
|
||||
monitorStatus: '',
|
||||
monitorStoreDays: 30,
|
||||
messageType: '',
|
||||
emailVars: '',
|
||||
weChatVars: '',
|
||||
dingVars: '',
|
||||
});
|
||||
let settingForm = ref();
|
||||
|
||||
type FormInstance = InstanceType<typeof ElForm>;
|
||||
const passFormRef = ref<FormInstance>();
|
||||
const passRules = reactive({
|
||||
|
@ -106,7 +83,7 @@ const passForm = reactive({
|
|||
|
||||
function checkPassword(rule: any, value: any, callback: any) {
|
||||
let password =
|
||||
settingForm.complexityVerification === 'disable' ? passForm.newPassword : passForm.newPasswordComplexity;
|
||||
settingForm.value.complexityVerification === 'disable' ? passForm.newPassword : passForm.newPasswordComplexity;
|
||||
if (password !== passForm.retryPassword) {
|
||||
return callback(new Error(i18n.global.t('commons.rule.rePassword')));
|
||||
}
|
||||
|
@ -118,7 +95,9 @@ const submitChangePassword = async (formEl: FormInstance | undefined) => {
|
|||
formEl.validate(async (valid) => {
|
||||
if (!valid) return;
|
||||
let password =
|
||||
settingForm.complexityVerification === 'disable' ? passForm.newPassword : passForm.newPasswordComplexity;
|
||||
settingForm.value.complexityVerification === 'disable'
|
||||
? passForm.newPassword
|
||||
: passForm.newPasswordComplexity;
|
||||
if (password === passForm.oldPassword) {
|
||||
MsgError(i18n.global.t('setting.duplicatePassword'));
|
||||
return;
|
||||
|
@ -130,7 +109,7 @@ const submitChangePassword = async (formEl: FormInstance | undefined) => {
|
|||
};
|
||||
const search = async () => {
|
||||
const res = await getSettingInfo();
|
||||
settingForm = res.data;
|
||||
settingForm.value = res.data;
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<el-form :model="form" ref="panelFormRef" label-position="left" label-width="160px">
|
||||
<el-row>
|
||||
<el-col :span="1"><br /></el-col>
|
||||
<el-col :span="10">
|
||||
<el-col :span="16">
|
||||
<el-form-item
|
||||
:label="$t('setting.enableMonitor')"
|
||||
:rules="Rules.requiredInput"
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<el-form :model="form" ref="panelFormRef" label-position="left" label-width="160px">
|
||||
<el-row>
|
||||
<el-col :span="1"><br /></el-col>
|
||||
<el-col :span="10">
|
||||
<el-col :span="16">
|
||||
<el-form-item :label="$t('setting.user')" :rules="Rules.userName" prop="userName">
|
||||
<el-input clearable v-model="form.userName">
|
||||
<template #append>
|
||||
|
@ -124,7 +124,7 @@
|
|||
import { ref, reactive, onMounted, computed } from 'vue';
|
||||
import { ElForm, ElMessageBox } from 'element-plus';
|
||||
import LayoutContent from '@/layout/layout-content.vue';
|
||||
import { syncTime, getSettingInfo, updateSetting } from '@/api/modules/setting';
|
||||
import { syncTime, getSettingInfo, updateSetting, getSystemAvailable } from '@/api/modules/setting';
|
||||
import { Rules, checkNumberRange } from '@/global/form-rules';
|
||||
import { GlobalStore } from '@/store';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
@ -304,5 +304,6 @@ const onSyncTime = async () => {
|
|||
|
||||
onMounted(() => {
|
||||
search();
|
||||
getSystemAvailable();
|
||||
});
|
||||
</script>
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
</el-input>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item :label="$t('setting.entrance')" required>
|
||||
<el-form-item :label="$t('setting.entrance')">
|
||||
<el-switch
|
||||
@change="handleEntrance"
|
||||
v-model="form.securityEntranceStatus"
|
||||
|
@ -49,11 +49,7 @@
|
|||
</span>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item
|
||||
:label="$t('setting.expirationTime')"
|
||||
prop="expirationTime"
|
||||
:rules="Rules.requiredInput"
|
||||
>
|
||||
<el-form-item :label="$t('setting.expirationTime')" prop="expirationTime">
|
||||
<el-input disabled v-model="form.expirationTime">
|
||||
<template #append>
|
||||
<el-button style="width: 85px" @click="onChangeExpirationTime" icon="Setting">
|
||||
|
@ -70,11 +66,7 @@
|
|||
</span>
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
:label="$t('setting.complexity')"
|
||||
prop="complexityVerification"
|
||||
:rules="Rules.requiredSelect"
|
||||
>
|
||||
<el-form-item :label="$t('setting.complexity')" prop="complexityVerification">
|
||||
<el-switch
|
||||
@change="
|
||||
onSave(panelFormRef, 'ComplexityVerification', form.complexityVerification)
|
||||
|
@ -87,11 +79,7 @@
|
|||
{{ $t('setting.complexityHelper') }}
|
||||
</span>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
:label="$t('setting.mfa')"
|
||||
prop="securityEntrance"
|
||||
:rules="Rules.requiredSelect"
|
||||
>
|
||||
<el-form-item :label="$t('setting.mfa')" prop="securityEntrance">
|
||||
<el-switch
|
||||
@change="handleMFA"
|
||||
v-model="form.mfaStatus"
|
||||
|
@ -134,7 +122,7 @@
|
|||
</el-card>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="https" required prop="ssl">
|
||||
<el-form-item label="https" prop="ssl">
|
||||
<el-switch
|
||||
@change="handleSSL"
|
||||
v-model="form.ssl"
|
||||
|
|
Loading…
Reference in New Issue