diff options
author | Vitaly Takmazov | 2016-08-10 12:34:01 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2016-08-10 12:34:01 +0300 |
commit | efe270f4ec97a74c3513ec5ae27f64e90e8fa945 (patch) | |
tree | 3b7d4dbe8239a1568c661d76c8ae32b1f533d612 /juick-www/src | |
parent | f8da0413163ccf941afd91217de2f767422362a4 (diff) |
juick-www: fix facebook login
Diffstat (limited to 'juick-www/src')
-rw-r--r-- | juick-www/src/main/java/com/juick/www/SignUp.java | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/juick-www/src/main/java/com/juick/www/SignUp.java b/juick-www/src/main/java/com/juick/www/SignUp.java index 865fc453b..a67d049aa 100644 --- a/juick-www/src/main/java/com/juick/www/SignUp.java +++ b/juick-www/src/main/java/com/juick/www/SignUp.java @@ -85,7 +85,7 @@ public class SignUp { out.println("<input type=\"hidden\" name=\"action\" value=\"link\"/>"); out.println("<input type=\"hidden\" name=\"type\" value=\"" + type + "\"/>"); out.println("<input type=\"hidden\" name=\"hash\" value=\"" + hash + "\"/>"); - if (visitor != null) { + if (visitor.getUID() > 0) { out.println("<input type=\"submit\" value=\"Связать с этим аккаунтом\"/>"); } else { out.println("<p>Имя пользователя: <input type=\"text\" name=\"username\"/></p>"); @@ -208,7 +208,12 @@ public class SignUp { private String getFacebookNameByHash(JdbcTemplate sql, String hash) { try { - return sql.queryForObject("SELECT fb_name,fb_link FROM facebook WHERE loginhash=?", String.class, hash); + List<Pair<String, String>> fb = sql.query("SELECT fb_name,fb_link FROM facebook WHERE loginhash=?", + (rs, num) -> Pair.of(rs.getString(1), rs.getString(2)), hash); + if (fb.size() > 0) { + return "<a href=\"" + fb.get(0).getRight() + "\" rel=\"nofollow\">" + fb.get(0).getLeft() + "</a>"; + } + return null; } catch (EmptyResultDataAccessException e) { return null; } |