feat: 登录强制校验弱密码&关键信息加密传输

This commit is contained in:
meilin.huang
2022-07-18 20:36:31 +08:00
parent db554ebdc9
commit 5271bd21e8
29 changed files with 1804 additions and 1327 deletions

View File

@@ -20,14 +20,19 @@
</el-select>
</el-form-item>
<el-form-item prop="host" label="host:" required>
<el-input v-model.trim="form.host" placeholder="请输入host:port集群模式用','分割" auto-complete="off" type="textarea"></el-input>
<el-input
v-model.trim="form.host"
placeholder="请输入host:port集群模式用','分割"
auto-complete="off"
type="textarea"
></el-input>
</el-form-item>
<el-form-item prop="password" label="密码:">
<el-input
type="password"
show-password
v-model.trim="form.password"
placeholder="请输入密码"
placeholder="请输入密码, 修改操作可不填"
autocomplete="new-password"
></el-input>
</el-form-item>
@@ -42,7 +47,7 @@
<template #footer>
<div class="dialog-footer">
<el-button @click="cancel()"> </el-button>
<el-button type="primary" :loading="btnLoading" @click="btnOk"> </el-button>
<el-button type="primary" :loading="btnLoading" @click="btnOk"> </el-button>
</div>
</template>
</el-dialog>
@@ -54,6 +59,7 @@ import { toRefs, reactive, watch, defineComponent, ref } from 'vue';
import { redisApi } from './api';
import { projectApi } from '../project/api.ts';
import { ElMessage } from 'element-plus';
import { RsaEncrypt } from '@/common/rsa';
export default defineComponent({
name: 'RedisEdit',
@@ -80,14 +86,14 @@ export default defineComponent({
form: {
id: null,
name: null,
mode: "standalone",
mode: 'standalone',
host: null,
password: null,
project: null,
projectId: null,
envId: null,
env: null,
remark: "",
remark: '',
},
btnLoading: false,
rules: {
@@ -166,9 +172,11 @@ export default defineComponent({
};
const btnOk = async () => {
redisForm.value.validate((valid: boolean) => {
redisForm.value.validate(async (valid: boolean) => {
if (valid) {
redisApi.saveRedis.request(state.form).then(() => {
const reqForm = { ...state.form };
reqForm.password = await RsaEncrypt(reqForm.password);
redisApi.saveRedis.request(reqForm).then(() => {
ElMessage.success('保存成功');
emit('val-change', state.form);
state.btnLoading = true;