diff options
author | Vitaly Takmazov | 2016-07-11 16:50:29 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2016-07-11 16:50:29 +0300 |
commit | 0cc4f35bfc0aaf70414e9e0a084147cefe1a38b3 (patch) | |
tree | 04ff6af4f772f8f53e820ca3330a43bf5746e8db /juick-core | |
parent | afadc6521ac2643a389fe11fe6b5863a0e6aa88a (diff) |
fix getSignUpHashByJID
Diffstat (limited to 'juick-core')
-rw-r--r-- | juick-core/src/main/java/com/juick/server/UserQueries.java | 8 |
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); } |