From e90c2aae6cc46dfee72c7be8ae84e8319d67cb85 Mon Sep 17 00:00:00 2001 From: lanrenwo Date: Tue, 5 Jul 2022 18:11:55 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=BC=B9=E7=AA=97=E9=87=8C?= =?UTF-8?q?=E6=A0=87=E7=AD=BE=E9=A1=B5=E7=9A=84=E7=94=A8=E6=88=B7=E4=BD=93?= =?UTF-8?q?=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/dbdata/userauth_ldap.go | 3 +-- web/src/pages/group/List.vue | 28 +++++++++++++++++++++++----- web/src/pages/user/Policy.vue | 25 ++++++++++++++++++++++--- 3 files changed, 46 insertions(+), 10 deletions(-) diff --git a/server/dbdata/userauth_ldap.go b/server/dbdata/userauth_ldap.go index 868e764..f6c6995 100644 --- a/server/dbdata/userauth_ldap.go +++ b/server/dbdata/userauth_ldap.go @@ -45,7 +45,7 @@ func (auth AuthLdap) checkData(authData map[string]interface{}) error { return errors.New("LDAP的用户查询密码不能为空") } if auth.BaseDn == "" || !ValidateDN(auth.BaseDn) { - return errors.New("LDAP的BaseName填写有误") + return errors.New("LDAP的BaseDN填写有误") } if auth.SearchAttr == "" { return errors.New("LDAP的搜索属性不能为空") @@ -117,7 +117,6 @@ func (auth AuthLdap) checkUser(name, pwd string, g *Group) error { return fmt.Errorf("LDAP发现 %s 用户,存在多个账号", name) } userDN := sr.Entries[0].DN - fmt.Println(userDN) err = l.Bind(userDN, pwd) if err != nil { return fmt.Errorf("%s LDAP 登入失败,请检查登入的账号或密码 %s", name, err.Error()) diff --git a/web/src/pages/group/List.vue b/web/src/pages/group/List.vue index 714416f..1014d6e 100644 --- a/web/src/pages/group/List.vue +++ b/web/src/pages/group/List.vue @@ -168,10 +168,11 @@ title="用户组" :visible.sync="user_edit_dialog" width="750px" + @close='closeDialog' center> - + @@ -359,7 +360,7 @@ 保存 - 取消 + 取消 @@ -473,10 +474,9 @@ export default { console.log(error); }); }, - handleEdit(row) { + handleEdit(row) { !this.$refs['ruleForm'] || this.$refs['ruleForm'].resetFields(); - console.log(row) - this.activeTab = "general" + console.log(row) this.user_edit_dialog = true if (!row) { this.setAuthData(row) @@ -561,6 +561,24 @@ export default { }, authTypeChange() { this.$refs['ruleForm'].clearValidate(); + }, + beforeTabLeave() { + var isSwitch = true + if (! this.user_edit_dialog) { + return isSwitch; + } + this.$refs['ruleForm'].validate((valid) => { + if (!valid) { + this.$message.error("错误:您有必填项没有填写。") + isSwitch = false; + return false; + } + }); + return isSwitch; + }, + closeDialog() { + this.user_edit_dialog = false; + this.activeTab = "general"; } }, } diff --git a/web/src/pages/user/Policy.vue b/web/src/pages/user/Policy.vue index b2a852e..848a38e 100644 --- a/web/src/pages/user/Policy.vue +++ b/web/src/pages/user/Policy.vue @@ -136,10 +136,11 @@ :visible.sync="user_edit_dialog" width="750px" top="50px" + @close='closeDialog' center> - + @@ -283,7 +284,7 @@ export default { re_upper_limit : 0, }, rules: { - name: [ + username: [ {required: true, message: '请输入用户名', trigger: 'blur'}, {max: 30, message: '长度小于 30 个字符', trigger: 'blur'} ], @@ -398,7 +399,25 @@ export default { } else { this.$set(this.readMore, id, true); } - }, + }, + beforeTabLeave() { + var isSwitch = true + if (! this.user_edit_dialog) { + return isSwitch; + } + this.$refs['ruleForm'].validate((valid) => { + if (!valid) { + this.$message.error("错误:您有必填项没有填写。") + isSwitch = false; + return false; + } + }); + return isSwitch; + }, + closeDialog() { + this.user_edit_dialog = false; + this.activeTab = "general"; + }, }, }