aboutsummaryrefslogtreecommitdiff
path: root/juick-www
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2016-08-10 12:34:01 +0300
committerGravatar Vitaly Takmazov2016-08-10 12:34:01 +0300
commitefe270f4ec97a74c3513ec5ae27f64e90e8fa945 (patch)
tree3b7d4dbe8239a1568c661d76c8ae32b1f533d612 /juick-www
parentf8da0413163ccf941afd91217de2f767422362a4 (diff)
juick-www: fix facebook login
Diffstat (limited to 'juick-www')
-rw-r--r--juick-www/src/main/java/com/juick/www/SignUp.java9
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 865fc453..a67d049a 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;
}