org = userRoles.stream().filter(ur -> ur.getRoleId().startsWith("org")).collect(Collectors.toList());
+ if (test.size() > 0) {
+ String wsId = test.get(0).getSourceId();
+ switchUserRole("workspace", wsId);
+ } else if (org.size() > 0) {
+ String orgId = org.get(0).getSourceId();
+ switchUserRole("organization", orgId);
+ }
+ }
+ // 返回 userDTO
+ return ResultHolder.success(subject.getSession().getAttribute("user"));
+ } else {
+ return ResultHolder.error(Translator.get("login_fail"));
+ }
+ } catch (ExcessiveAttemptsException e) {
+ msg = Translator.get("excessive_attempts");
+ } catch (LockedAccountException e) {
+ msg = Translator.get("user_locked");
+ } catch (DisabledAccountException e) {
+ msg = Translator.get("user_has_been_disabled");
+ } catch (ExpiredCredentialsException e) {
+ msg = Translator.get("user_expires");
+ } catch (AuthenticationException e) {
+ msg = e.getMessage();
+ } catch (UnauthorizedException e) {
+ msg = Translator.get("not_authorized") + e.getMessage();
+ }
+ return ResultHolder.error(msg);
+ }
}
diff --git a/frontend/src/business/components/settings/personal/PersonSetting.vue b/frontend/src/business/components/settings/personal/PersonSetting.vue
index 07050c3259..05b2cbbba2 100644
--- a/frontend/src/business/components/settings/personal/PersonSetting.vue
+++ b/frontend/src/business/components/settings/personal/PersonSetting.vue
@@ -154,6 +154,17 @@
this.form = Object.assign({}, row);
},
editPassword(row) {
+ this.$get("ldap/test", res => {
+ console.log(res)
+ })
+
+ this.$get("ldap/find/admin", res => {
+ console.log(res)
+ })
+
+ this.$get("ldap/testUser", res => {
+ console.log(res)
+ })
this.editPasswordVisible = true;
},
updateUser(updateUserForm) {
diff --git a/frontend/src/login/Login.vue b/frontend/src/login/Login.vue
index 8d2fdad0cd..dc3cc5a087 100644
--- a/frontend/src/login/Login.vue
+++ b/frontend/src/login/Login.vue
@@ -15,6 +15,12 @@
{{$t('commons.welcome')}}
+
+
+ LDAP
+ 普通登录
+
+
@@ -60,7 +66,8 @@
return {
form: {
username: '',
- password: ''
+ password: '',
+ authenticate: 'normal'
},
rules: {
username: [
@@ -105,24 +112,43 @@
submit(form) {
this.$refs[form].validate((valid) => {
if (valid) {
- this.$post("signin", this.form, response => {
- saveLocalStorage(response);
- let language = response.data.language;
-
- if (!language) {
- this.$get("language", response => {
- language = response.data;
- localStorage.setItem(DEFAULT_LANGUAGE, language)
- window.location.href = "/"
- })
- } else {
- window.location.href = "/"
- }
- });
+ switch (this.form.authenticate) {
+ case "normal":
+ this.normalLogin();
+ break;
+ case "ldap":
+ this.ldapLogin();
+ break;
+ default:
+ this.normalLogin();
+ }
} else {
return false;
}
});
+ },
+ normalLogin() {
+ this.$post("signin", this.form, response => {
+ saveLocalStorage(response);
+ this.getLanguage(response.data.language);
+ });
+ },
+ ldapLogin() {
+ this.$post("ldap/signin", this.form, response => {
+ saveLocalStorage(response);
+ this.getLanguage(response.data.language);
+ });
+ },
+ getLanguage(language) {
+ if (!language) {
+ this.$get("language", response => {
+ language = response.data;
+ localStorage.setItem(DEFAULT_LANGUAGE, language)
+ window.location.href = "/"
+ })
+ } else {
+ window.location.href = "/"
+ }
}
}
}
@@ -174,7 +200,7 @@
}
.form {
- margin-top: 60px;
+ margin-top: 30px;
padding: 0 40px;
}