Skip to content

Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance

display configured adminUserName in ConfigAccounts_p - fix read default username in in loginservice

reger3d913558aba4
diff --git a/htroot/ConfigAccounts_p.java b/htroot/ConfigAccounts_p.java
index 533dfc81f..a80176cbc 100644
--- a/htroot/ConfigAccounts_p.java
+++ b/htroot/ConfigAccounts_p.java
@@ -96,7 +96,7 @@ public class ConfigAccounts_p {
prop.put("localhost.checked", (localhostAccess) ? 1 : 0);
prop.put("account.checked", (localhostAccess) ? 0 : 1);
prop.put("statusPassword", localhostAccess ? "0" : "1");
- prop.put("defaultUser", "admin");
+ prop.put("defaultUser", env.getConfig("adminAccountUserName", "admin"));
//default values
prop.put("current_user", "newuser");
diff --git a/source/net/yacy/http/YaCyLoginService.java b/source/net/yacy/http/YaCyLoginService.java
index e60ec2245..bc0d798ae 100644
--- a/source/net/yacy/http/YaCyLoginService.java
+++ b/source/net/yacy/http/YaCyLoginService.java
@@ -49,7 +49,7 @@ public class YaCyLoginService extends MappedLoginService {
// TODO: implement legacy credentials
final Switchboard sb = Switchboard.getSwitchboard();
- String adminuser = sb.getConfig("adminAccount", "admin");
+ String adminuser = sb.getConfig("adminAccountUserName", "admin");
if (username.equals(adminuser)) {
final String adminAccountBase64MD5 = sb.getConfig(SwitchboardConstants.ADMIN_ACCOUNT_B64MD5, "");
// in YaCy the credential hash is composed of username:pwd so the username is needed to create valid credential
@@ -69,9 +69,8 @@ public class YaCyLoginService extends MappedLoginService {
} else { // get user data from UserDB
Entry user = sb.userDB.getEntry(username);
if (user != null) {
- String[] role;
if (user.hasRight(AccessRight.ADMIN_RIGHT)) {
- role = new String[]{AccessRight.ADMIN_RIGHT.toString()};
+ String[] role = new String[]{AccessRight.ADMIN_RIGHT.toString()};
Credential credential = YaCyLegacyCredential.getCredentials(username, user.getMD5EncodedUserPwd());
Principal userPrincipal = new MappedLoginService.KnownUser(username, credential);