From 91bf74631157d8e559686ca25e4980f155d88438 Mon Sep 17 00:00:00 2001 From: Ugnich Anton Date: Fri, 30 Aug 2013 13:10:14 +0700 Subject: PM --- src/java/com/juick/api/Utils.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/java/com/juick/api/Utils.java') diff --git a/src/java/com/juick/api/Utils.java b/src/java/com/juick/api/Utils.java index cac5612d..b406c362 100644 --- a/src/java/com/juick/api/Utils.java +++ b/src/java/com/juick/api/Utils.java @@ -70,8 +70,8 @@ public class Utils { } public static int getHttpAuthUID(Connection sql, HttpServletRequest request) { - String auth = request.getHeader("HTTP_AUTHORIZATION"); - if (auth != null && auth.length() > 8) { + String auth = request.getHeader("Authorization"); + if (auth != null && auth.length() > 8 && auth.startsWith("Basic ")) { try { BASE64Decoder dec = new BASE64Decoder(); String loginpassw[] = new String(dec.decodeBuffer(auth.substring(6))).split(":", 2); @@ -84,6 +84,14 @@ public class Utils { return 0; } + public static int getVisitorQueryStringUID(Connection sql, HttpServletRequest request) { + String hash = request.getParameter("hash"); + if (hash != null && hash.length() == 16) { + return com.juick.server.UserQueries.getUIDbyHash(sql, hash); + } + return 0; + } + public static void sendPermanentRedirect(HttpServletResponse response, String location) { response.setStatus(HttpServletResponse.SC_MOVED_PERMANENTLY); response.setHeader("Location", location); -- cgit v1.2.3