diff --git a/htroot/ConfigBasic.html b/htroot/ConfigBasic.html index 493ffa909..d7fa245e6 100644 --- a/htroot/ConfigBasic.html +++ b/htroot/ConfigBasic.html @@ -28,8 +28,8 @@ Your YaCy Peer needs some basic information to operate properly
  • #(statusPassword)#Please set a password for your peer to protect your settings::Password is set#(/statusPassword)#
    Peer User:
    Peer Password:
    - Peer Password:
  • -
  • #(statusPort)#Your peer cannot be reached from outside; please open your firewall for this port and/or set a virtual server option in your router to allow connections on this port::Your peer can be reached by other peers#(/statusPort)#
    + Peer Password: (repeat same password)
  • +
  • #(statusPort)#Your peer cannot be reached from outside; please open your firewall for this port and/or set a virtual server option in your router to allow connections on this port::Your peer can be reached by other peers#(/statusPort)#
    Peer Port:

  •      diff --git a/htroot/ConfigBasic.java b/htroot/ConfigBasic.java index 1c504061b..81f524df4 100644 --- a/htroot/ConfigBasic.java +++ b/htroot/ConfigBasic.java @@ -49,8 +49,10 @@ import de.anomic.http.httpHeader; import de.anomic.kelondro.kelondroBase64Order; +import de.anomic.plasma.plasmaSwitchboard; import de.anomic.server.serverCodings; import de.anomic.server.serverCore; +import de.anomic.server.serverInstantThread; import de.anomic.server.serverObjects; import de.anomic.server.serverSwitch; import de.anomic.yacy.yacyCore; @@ -60,9 +62,17 @@ public class ConfigBasic { public static serverObjects respond(httpHeader header, serverObjects post, serverSwitch env) { // return variable that accumulates replacements + plasmaSwitchboard sb = (plasmaSwitchboard) env; serverObjects prop = new serverObjects(); - //yacyCore.peerPing(); + int authentication = sb.adminAuthenticated(header); + if (authentication < 2) { + // must authenticate + prop.put("AUTHENTICATE", "admin log-in"); + return prop; + } + + serverInstantThread.oneTimeJob(sb.yc, "peerPing", null, 0); // password settings String user = (post == null) ? "" : (String) post.get("adminuser", ""); @@ -70,13 +80,13 @@ public class ConfigBasic { String pw2 = (post == null) ? "" : (String) post.get("adminpw2", ""); // peer name settings - String peerName = (post == null) ? "" : (String) post.get("peername", ""); + String peerName = (post == null) ? env.getConfig("peerName","") : (String) post.get("peername", ""); // port settings - String port = (post == null) ? "8080" : (String) post.get("port", "8080"); + String port = (post == null) ? env.getConfig("port", "8080") : (String) post.get("port", "8080"); // admin password - if ((user.length() > 0) && (!(pw1.equals(pw2)))) { + if ((user.length() > 0) && (pw1.equals(pw2))) { // check passed. set account: env.setConfig("adminAccountBase64MD5", serverCodings.encodeMD5Hex(kelondroBase64Order.standardCoder.encodeString(user + ":" + pw1))); env.setConfig("adminAccount", ""); diff --git a/htroot/EditProfile_p.html b/htroot/ConfigProfile_p.html similarity index 95% rename from htroot/EditProfile_p.html rename to htroot/ConfigProfile_p.html index 1c5a6df9c..e3af9ca53 100644 --- a/htroot/EditProfile_p.html +++ b/htroot/ConfigProfile_p.html @@ -6,7 +6,8 @@ #%env/templates/header.template%# -

    +#%env/templates/submenuConfig.template%# +

    Your Personal Profile

    You can create a personal profile here. Other YaCy users can view these information using a link on the network page.
    diff --git a/htroot/EditProfile_p.java b/htroot/ConfigProfile_p.java similarity index 97% rename from htroot/EditProfile_p.java rename to htroot/ConfigProfile_p.java index f7a0fb44c..2280f5d3d 100644 --- a/htroot/EditProfile_p.java +++ b/htroot/ConfigProfile_p.java @@ -59,7 +59,7 @@ import de.anomic.server.serverSwitch; import de.anomic.yacy.yacyNewsRecord; import de.anomic.yacy.yacyCore; -public class EditProfile_p { +public class ConfigProfile_p { public static serverObjects respond(httpHeader header, serverObjects post, serverSwitch env) { //listManager.switchboard = (plasmaSwitchboard) env; diff --git a/htroot/env/templates/header.template b/htroot/env/templates/header.template index ca756cacf..780ddbb40 100644 --- a/htroot/env/templates/header.template +++ b/htroot/env/templates/header.template @@ -51,15 +51,15 @@  File Share  Wiki   Messages  -   Personal Profile  Peer Control +   Basic Configuration +   Advanced Settings  Status  Network  News   Log -   Settings   Performance   Connections   Language diff --git a/htroot/env/templates/submenuConfig.template b/htroot/env/templates/submenuConfig.template index c71057c25..162bae253 100644 --- a/htroot/env/templates/submenuConfig.template +++ b/htroot/env/templates/submenuConfig.template @@ -1,11 +1,14 @@ - - + + - - + + \ No newline at end of file diff --git a/source/de/anomic/plasma/plasmaSwitchboard.java b/source/de/anomic/plasma/plasmaSwitchboard.java index 2b3847589..0ff87ce40 100644 --- a/source/de/anomic/plasma/plasmaSwitchboard.java +++ b/source/de/anomic/plasma/plasmaSwitchboard.java @@ -1966,13 +1966,12 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser public int adminAuthenticated(httpHeader header) { String adminAccountBase64MD5 = getConfig("adminAccountBase64MD5", ""); - if (adminAccountBase64MD5.length() == 0) return 2; // not necessary + if (adminAccountBase64MD5.length() == 0) return 2; // no passwrd stored String authorization = ((String) header.get(httpHeader.AUTHORIZATION, "xxxxxx")).trim().substring(6); if (authorization.length() == 0) return 1; // no authentication information given if ((((String) header.get("CLIENTIP", "")).equals("localhost")) && (adminAccountBase64MD5.equals(authorization))) return 3; // soft-authenticated for localhost if (adminAccountBase64MD5.equals(serverCodings.encodeMD5Hex(authorization))) return 4; // hard-authenticated, all ok - if(userDB.hasAdminRight((String)header.get(httpHeader.AUTHORIZATION, "xxxxxx"))) - return 4; + if (userDB.hasAdminRight((String)header.get(httpHeader.AUTHORIZATION, "xxxxxx"))) return 4; return 0; // wrong password } diff --git a/source/yacy.java b/source/yacy.java index af82cf475..7aab0b815 100644 --- a/source/yacy.java +++ b/source/yacy.java @@ -380,7 +380,9 @@ public final class yacy { // open the browser window final boolean browserPopUpTrigger = sb.getConfig("browserPopUpTrigger", "true").equals("true"); if (browserPopUpTrigger) { - final String browserPopUpPage = sb.getConfig("browserPopUpPage", "Status.html"); + String browserPopUpPage = sb.getConfig("browserPopUpPage", "ConfigBasic.html"); + boolean properPW = (sb.getConfig("adminAccount", "").length() == 0) && (sb.getConfig("adminAccountBase64MD5", "").length() > 0); + if (!properPW) browserPopUpPage = "ConfigBasic.html"; final String browserPopUpApplication = sb.getConfig("browserPopUpApplication", "netscape"); serverSystem.openBrowser("http://localhost:" + serverCore.getPortNr(port) + "/" + browserPopUpPage, browserPopUpApplication); }