mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2024-11-30 23:49:10 +08:00
parent
30c577dbaf
commit
14142be38f
@ -12,6 +12,8 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/1Panel-dev/1Panel/backend/app/dto"
|
||||
"github.com/1Panel-dev/1Panel/backend/buserr"
|
||||
"github.com/1Panel-dev/1Panel/backend/constant"
|
||||
"github.com/1Panel-dev/1Panel/backend/global"
|
||||
"github.com/1Panel-dev/1Panel/backend/utils/cmd"
|
||||
"github.com/1Panel-dev/1Panel/backend/utils/common"
|
||||
@ -189,6 +191,9 @@ func (u *DeviceService) UpdateHosts(req []dto.HostHelper) error {
|
||||
func (u *DeviceService) UpdatePasswd(req dto.ChangePasswd) error {
|
||||
std, err := cmd.Execf("%s echo '%s:%s' | %s chpasswd", cmd.SudoHandleCmd(), req.User, req.Passwd, cmd.SudoHandleCmd())
|
||||
if err != nil {
|
||||
if strings.Contains(err.Error(), "does not exist") {
|
||||
return buserr.New(constant.ErrNotExistUser)
|
||||
}
|
||||
return errors.New(std)
|
||||
}
|
||||
return nil
|
||||
|
@ -35,7 +35,7 @@ func (u *Fail2BanService) LoadBaseInfo() (dto.Fail2BanBaseInfo, error) {
|
||||
return baseInfo, err
|
||||
}
|
||||
baseInfo.IsEnable, baseInfo.IsActive, baseInfo.IsExist = client.Status()
|
||||
if !baseInfo.IsExist {
|
||||
if !baseInfo.IsActive {
|
||||
baseInfo.Version = "-"
|
||||
return baseInfo, nil
|
||||
}
|
||||
|
@ -144,3 +144,7 @@ var (
|
||||
var (
|
||||
ErrBashExecute = "ErrBashExecute"
|
||||
)
|
||||
|
||||
var (
|
||||
ErrNotExistUser = "ErrNotExistUser"
|
||||
)
|
||||
|
@ -156,3 +156,6 @@ ErrFirewall: "No firewalld or ufw service is detected. Please check and try agai
|
||||
|
||||
#cronjob
|
||||
ErrBashExecute: "Script execution error, please check the specific information in the task output text area."
|
||||
|
||||
#toolbox
|
||||
ErrNotExistUser: "The current user does not exist. Please modify and retry!"
|
||||
|
@ -157,3 +157,6 @@ ErrFirewall: "當前未檢測到系統 firewalld 或 ufw 服務,請檢查後
|
||||
|
||||
#cronjob
|
||||
ErrBashExecute: "腳本執行錯誤,請在任務輸出文本域中查看具體信息。"
|
||||
|
||||
#toolbox
|
||||
ErrNotExistUser: "當前使用者不存在,請修改後重試!"
|
||||
|
@ -156,3 +156,6 @@ ErrFirewall: "当前未检测到系统 firewalld 或 ufw 服务,请检查后
|
||||
|
||||
#cronjob
|
||||
ErrBashExecute: "脚本执行错误,请在任务输出文本域中查看具体信息。"
|
||||
|
||||
#toolbox
|
||||
ErrNotExistUser: "当前用户不存在,请修改后重试!"
|
@ -1153,10 +1153,10 @@ const message = {
|
||||
setting: {
|
||||
all: 'All',
|
||||
panel: 'Panel',
|
||||
userChange: 'Change username',
|
||||
userChangeHelper: 'Change the user name to log out. Do you want to continue?',
|
||||
user: 'User Name',
|
||||
passwd: 'Password',
|
||||
user: 'Panel User',
|
||||
userChange: 'Change Panel User',
|
||||
userChangeHelper: 'Changing the panel user will log you out. Continue?',
|
||||
passwd: 'Panel Password',
|
||||
emailHelper: 'For password retrieval',
|
||||
title: 'Panel Alias',
|
||||
panelPort: 'Panel Port',
|
||||
|
@ -1097,10 +1097,10 @@ const message = {
|
||||
setting: {
|
||||
all: '全部',
|
||||
panel: '面板',
|
||||
user: '用戶名稱',
|
||||
userChange: '修改用戶名',
|
||||
userChangeHelper: '修改用戶名將退出登陸,是否繼續?',
|
||||
passwd: '用戶密碼',
|
||||
user: '面板用户',
|
||||
userChange: '修改面板用户',
|
||||
userChangeHelper: '修改面板用户将退出登录,是否继续?',
|
||||
passwd: '面板密码',
|
||||
emailHelper: '用於密碼找回',
|
||||
title: '面板別名',
|
||||
panelPort: '面板端口',
|
||||
|
@ -1098,10 +1098,10 @@ const message = {
|
||||
setting: {
|
||||
all: '全部',
|
||||
panel: '面板',
|
||||
user: '用户名称',
|
||||
userChange: '修改用户名',
|
||||
userChangeHelper: '修改用户名将退出登陆,是否继续?',
|
||||
passwd: '用户密码',
|
||||
user: '面板用户',
|
||||
userChange: '修改面板用户',
|
||||
userChangeHelper: '修改面板用户将退出登陆,是否继续?',
|
||||
passwd: '面板密码',
|
||||
emailHelper: '用于密码找回',
|
||||
title: '面板别名',
|
||||
panelPort: '面板端口',
|
||||
|
@ -7,7 +7,7 @@
|
||||
<el-form ref="formRef" label-position="top" :model="form" @submit.prevent v-loading="loading">
|
||||
<el-row type="flex" justify="center">
|
||||
<el-col :span="22">
|
||||
<el-form-item :label="$t('setting.title')" prop="panelName" :rules="Rules.requiredInput">
|
||||
<el-form-item :label="$t('setting.title')" prop="panelName" :rules="Rules.simpleName">
|
||||
<el-input clearable v-model="form.panelName" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
@ -2,7 +2,7 @@
|
||||
<div>
|
||||
<el-drawer v-model="drawerVisible" :destroy-on-close="true" :close-on-click-modal="false" size="30%">
|
||||
<template #header>
|
||||
<DrawerHeader :header="$t('commons.login.username')" :back="handleClose" />
|
||||
<DrawerHeader :header="$t('setting.user')" :back="handleClose" />
|
||||
</template>
|
||||
<el-form
|
||||
ref="formRef"
|
||||
@ -14,7 +14,7 @@
|
||||
>
|
||||
<el-row type="flex" justify="center">
|
||||
<el-col :span="22">
|
||||
<el-form-item :label="$t('commons.login.username')" prop="userName">
|
||||
<el-form-item :label="$t('setting.user')" prop="userName">
|
||||
<el-input clearable v-model.trim="form.userName" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
@ -4,15 +4,18 @@
|
||||
<template #header>
|
||||
<DrawerHeader :header="$t('toolbox.fail2ban.maxRetry')" :back="handleClose" />
|
||||
</template>
|
||||
<el-form ref="formRef" label-position="top" :model="form" @submit.prevent v-loading="loading">
|
||||
<el-form
|
||||
ref="formRef"
|
||||
label-position="top"
|
||||
:rules="rules"
|
||||
:model="form"
|
||||
@submit.prevent
|
||||
v-loading="loading"
|
||||
>
|
||||
<el-row type="flex" justify="center">
|
||||
<el-col :span="22">
|
||||
<el-form-item
|
||||
:label="$t('toolbox.fail2ban.maxRetry')"
|
||||
prop="maxRetry"
|
||||
:rules="Rules.requiredInput"
|
||||
>
|
||||
<el-input clearable v-model.number="form.maxRetry">
|
||||
<el-form-item :label="$t('toolbox.fail2ban.maxRetry')" prop="maxRetry">
|
||||
<el-input type="number" clearable v-model.number="form.maxRetry">
|
||||
<template #append>{{ $t('commons.units.time') }}</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
@ -35,7 +38,7 @@ import { reactive, ref } from 'vue';
|
||||
import i18n from '@/lang';
|
||||
import { MsgSuccess } from '@/utils/message';
|
||||
import { FormInstance } from 'element-plus';
|
||||
import { Rules } from '@/global/form-rules';
|
||||
import { Rules, checkNumberRange } from '@/global/form-rules';
|
||||
import DrawerHeader from '@/components/drawer-header/index.vue';
|
||||
import { updateFail2ban } from '@/api/modules/toolbox';
|
||||
|
||||
@ -51,6 +54,10 @@ const form = reactive({
|
||||
maxRetry: 5,
|
||||
});
|
||||
|
||||
const rules = reactive({
|
||||
maxRetry: [Rules.number, checkNumberRange(1, 99)],
|
||||
});
|
||||
|
||||
const formRef = ref<FormInstance>();
|
||||
|
||||
const acceptParams = (params: DialogProps): void => {
|
||||
|
Loading…
Reference in New Issue
Block a user