diff --git a/backend/src/main/java/io/metersphere/security/ShiroDBRealm.java b/backend/src/main/java/io/metersphere/security/ShiroDBRealm.java index f21b8e3315..30927a2ef2 100644 --- a/backend/src/main/java/io/metersphere/security/ShiroDBRealm.java +++ b/backend/src/main/java/io/metersphere/security/ShiroDBRealm.java @@ -117,7 +117,7 @@ public class ShiroDBRealm extends AuthorizingRealm { UserDTO user = userService.getLoginUser(userId, Arrays.asList(UserSource.LDAP.name(), UserSource.LOCAL.name())); String msg; if (user == null) { - user = userService.getLoginUserByEmail(email, Arrays.asList(UserSource.LDAP.name(), UserSource.LOCAL.name())); + user = userService.getUserDTOByEmail(email, UserSource.LDAP.name(), UserSource.LOCAL.name()); if (user == null) { msg = "The user does not exist: " + userId; logger.warn(msg); @@ -136,7 +136,7 @@ public class ShiroDBRealm extends AuthorizingRealm { UserDTO user = userService.getLoginUser(userId, Collections.singletonList(UserSource.LOCAL.name())); String msg; if (user == null) { - user = userService.getLoginUserByEmail(userId, Collections.singletonList(UserSource.LOCAL.name())); + user = userService.getUserDTOByEmail(userId, UserSource.LOCAL.name()); if (user == null) { msg = "The user does not exist: " + userId; logger.warn(msg); diff --git a/backend/src/main/java/io/metersphere/service/UserService.java b/backend/src/main/java/io/metersphere/service/UserService.java index f61843832b..3f64c00ffc 100644 --- a/backend/src/main/java/io/metersphere/service/UserService.java +++ b/backend/src/main/java/io/metersphere/service/UserService.java @@ -199,23 +199,21 @@ public class UserService { return getUserDTO(userId); } - public UserDTO getUserDTOByEmail(String email) { + public UserDTO getUserDTOByEmail(String email, String... source) { UserExample example = new UserExample(); - example.createCriteria().andEmailEqualTo(email); - List users = userMapper.selectByExample(example); - if (users == null || users.size() <= 0) { - return null; - } - return getUserDTO(users.get(0).getId()); - } + UserExample.Criteria criteria = example.createCriteria(); + criteria.andEmailEqualTo(email); + + if (!CollectionUtils.isEmpty(Arrays.asList(source))) { + criteria.andSourceIn(Arrays.asList(source)); + } - public UserDTO getLoginUserByEmail(String email, List list) { - UserExample example = new UserExample(); - example.createCriteria().andEmailEqualTo(email).andSourceIn(list); List users = userMapper.selectByExample(example); + if (users == null || users.size() <= 0) { return null; } + return getUserDTO(users.get(0).getId()); } diff --git a/frontend/src/business/components/settings/system/LdapSetting.vue b/frontend/src/business/components/settings/system/LdapSetting.vue index 785101f267..b2eb58ddba 100644 --- a/frontend/src/business/components/settings/system/LdapSetting.vue +++ b/frontend/src/business/components/settings/system/LdapSetting.vue @@ -3,33 +3,34 @@ - + - + + auto-complete="new-password"/> - + - + - + - +
{{$t('ldap.test_connect')}} - {{$t('ldap.test_login')}} + + {{$t('ldap.test_login')}} {{$t('ldap.edit')}} {{$t('commons.save')}} @@ -98,7 +99,7 @@ init() { this.result = this.$get("/system/ldap/info", response => { this.form = response.data; - this.form.open = this.form.open === 'true' ? true : false; + this.form.open = this.form.open === 'true'; this.$nextTick(() => { this.$refs.form.clearValidate(); }) @@ -121,7 +122,7 @@ if (!this.checkParam()) { return false; } - this.result = this.$post("/ldap/test/connect", this.form, response => { + this.result = this.$post("/ldap/test/connect", this.form, () => { this.$success(this.$t('commons.connection_successful')); this.showLogin = true; }, () => { @@ -179,11 +180,11 @@ {paramKey: "ldap.filter", paramValue: this.form.filter, type: "text", sort: 5}, {paramKey: "ldap.mapping", paramValue: this.form.mapping, type: "text", sort: 6}, {paramKey: "ldap.open", paramValue: this.form.open, type: "text", sort: 7} - ] + ]; this.$refs[form].validate(valid => { if (valid) { - this.result = this.$post("/system/save/ldap", param, response => { + this.result = this.$post("/system/save/ldap", param, () => { this.show = true; this.showEdit = true; this.showSave = false; @@ -200,7 +201,7 @@ login(form) { this.$refs[form].validate(valid => { if (valid) { - this.result = this.$post("/ldap/test/login", this.loginForm, response => { + this.result = this.$post("/ldap/test/login", this.loginForm, () => { this.$success(this.$t('ldap.login_success')); }); } else { diff --git a/frontend/src/business/components/track/plan/components/TestPlanList.vue b/frontend/src/business/components/track/plan/components/TestPlanList.vue index c2807fe371..6b9e3f3479 100644 --- a/frontend/src/business/components/track/plan/components/TestPlanList.vue +++ b/frontend/src/business/components/track/plan/components/TestPlanList.vue @@ -100,7 +100,7 @@ - + @@ -225,7 +225,7 @@ this.initTableData(); }, openTestReportTemplate(data) { - this.$refs.testReporTtemplateList.open(data.id); + this.$refs.testReportTemplateList.open(data.id); }, openReport(planId, reportId) { if (reportId) { diff --git a/frontend/src/business/components/track/plan/view/comonents/TestPlanTestCaseList.vue b/frontend/src/business/components/track/plan/view/comonents/TestPlanTestCaseList.vue index c02891d832..ecbb4b5ac4 100644 --- a/frontend/src/business/components/track/plan/view/comonents/TestPlanTestCaseList.vue +++ b/frontend/src/business/components/track/plan/view/comonents/TestPlanTestCaseList.vue @@ -161,7 +161,7 @@ :is-read-only="isReadOnly" @refreshTable="search"/> - + @@ -391,7 +391,7 @@ this.initTableData(); }, openTestReport() { - this.$refs.testReporTtemplateList.open(this.planId); + this.$refs.testReportTemplateList.open(this.planId); }, statusChange(param) { this.$post('/test/plan/case/edit', param, () => {