aboutsummaryrefslogtreecommitdiff
path: root/juick-core/src
diff options
context:
space:
mode:
Diffstat (limited to 'juick-core/src')
-rw-r--r--juick-core/src/main/java/com/juick/server/UserQueries.java8
1 files changed, 5 insertions, 3 deletions
diff --git a/juick-core/src/main/java/com/juick/server/UserQueries.java b/juick-core/src/main/java/com/juick/server/UserQueries.java
index 0db929bd..97d40968 100644
--- a/juick-core/src/main/java/com/juick/server/UserQueries.java
+++ b/juick-core/src/main/java/com/juick/server/UserQueries.java
@@ -53,9 +53,11 @@ public class UserQueries {
}
public static String getSignUpHashByJID(JdbcTemplate sql, String jid) {
- String hash = sql.queryForObject("SELECT loginhash FROM jids WHERE jid=? AND user_id IS NULL",
- String.class, jid);
- if (hash == null) {
+ String hash;
+ try {
+ hash = sql.queryForObject("SELECT loginhash FROM jids WHERE jid=? AND user_id IS NULL",
+ String.class, jid);
+ } catch (EmptyResultDataAccessException e) {
hash = UUID.randomUUID().toString();
sql.update("INSERT INTO jids(jid,loginhash) VALUES (?,?)", jid, hash);
}