From 4ab88abcf1bf993d67820733be6dafa6893be79e Mon Sep 17 00:00:00 2001 From: GaidamakUA Date: Thu, 17 Mar 2016 14:17:22 +0200 Subject: [PATCH] Fixed bug: Now user details aren't send if "Anonymous" switch checked. --- .../net/osmand/plus/osmedit/OsmBugsRemoteUtil.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/osmedit/OsmBugsRemoteUtil.java b/OsmAnd/src/net/osmand/plus/osmedit/OsmBugsRemoteUtil.java index 9dff11a039..955a05ebcf 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/OsmBugsRemoteUtil.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/OsmBugsRemoteUtil.java @@ -95,14 +95,15 @@ public class OsmBugsRemoteUtil implements OsmBugsUtil { return loginResult; } } - return editingPOI(b.toString(), POST, msg); + return editingPOI(b.toString(), POST, msg, anonymous); } public OsmBugResult validateLoginDetails() { - return editingPOI(getUserDetailsApi(), GET, "validate_login"); + return editingPOI(getUserDetailsApi(), GET, "validate_login", false); } - private OsmBugResult editingPOI(String url, String requestMethod, String userOperation) { + private OsmBugResult editingPOI(String url, String requestMethod, String userOperation, + boolean anonymous) { OsmBugResult r = new OsmBugResult(); try { HttpURLConnection connection = NetworkUtils.getHttpURLConnection(url); @@ -111,8 +112,10 @@ public class OsmBugsRemoteUtil implements OsmBugsUtil { connection.setRequestMethod(requestMethod); connection.setRequestProperty("User-Agent", Version.getFullVersion(app)); //$NON-NLS-1$ - String token = settings.USER_NAME.get() + ":" + settings.USER_PASSWORD.get(); //$NON-NLS-1$ - connection.addRequestProperty("Authorization", "Basic " + Base64.encode(token.getBytes("UTF-8"))); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + if (!anonymous) { + String token = settings.USER_NAME.get() + ":" + settings.USER_PASSWORD.get(); //$NON-NLS-1$ + connection.addRequestProperty("Authorization", "Basic " + Base64.encode(token.getBytes("UTF-8"))); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + } connection.setDoInput(true); connection.connect();