display configured adminUserName in ConfigAccounts_p

- fix read default username in  in loginservice
pull/1/head
reger 11 years ago
parent fbdd89e198
commit 3d913558ab

@ -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");

@ -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);

Loading…
Cancel
Save