diff options
author | Alexander Alexeev | 2016-11-14 16:00:58 +0700 |
---|---|---|
committer | Vitaly Takmazov | 2016-11-15 09:49:13 +0300 |
commit | f1f61379cab08ecff28e125cba3aa68b78fd66d7 (patch) | |
tree | 95a0cc659ff850927b30c00ba7a39eadf90ec2c7 | |
parent | d03e8b19d346563afec5fb2b6b9c9dcea68040e0 (diff) |
bugfixes
4 files changed, 10 insertions, 6 deletions
diff --git a/juick-api/src/main/java/com/juick/api/PM.java b/juick-api/src/main/java/com/juick/api/PM.java index 631ae978..44c43f89 100644 --- a/juick-api/src/main/java/com/juick/api/PM.java +++ b/juick-api/src/main/java/com/juick/api/PM.java @@ -3,6 +3,7 @@ package com.juick.api; import com.juick.json.MessageSerializer; import com.juick.server.PMQueries; import com.juick.server.UserQueries; +import com.juick.util.UserUtils; import com.juick.xmpp.JID; import com.juick.xmpp.Message; import com.juick.xmpp.Stream; @@ -57,7 +58,7 @@ public class PM { throws ServletException, IOException { String uname = request.getParameter("uname"); int uid = 0; - if (UserQueries.checkUserNameValid(uname)) { + if (UserUtils.checkUserNameValid(uname)) { uid = UserQueries.getUIDbyName(sql, uname); } diff --git a/juick-api/src/main/java/com/juick/api/Users.java b/juick-api/src/main/java/com/juick/api/Users.java index e85c517a..2be288bc 100644 --- a/juick-api/src/main/java/com/juick/api/Users.java +++ b/juick-api/src/main/java/com/juick/api/Users.java @@ -3,6 +3,7 @@ package com.juick.api; import com.juick.User; import com.juick.json.UserSerializer; import com.juick.server.UserQueries; +import com.juick.util.UserUtils; import org.springframework.jdbc.core.JdbcTemplate; import javax.servlet.ServletException; @@ -77,7 +78,7 @@ public class Users { if (uname == null) { uid = vuid; } else { - if (UserQueries.checkUserNameValid(uname)) { + if (UserUtils.checkUserNameValid(uname)) { com.juick.User u = UserQueries.getUserByName(sql, uname); if (u != null && u.getUID() > 0) { uid = u.getUID(); @@ -107,7 +108,7 @@ public class Users { if (uname == null) { uid = vuid; } else { - if (UserQueries.checkUserNameValid(uname)) { + if (UserUtils.checkUserNameValid(uname)) { com.juick.User u = UserQueries.getUserByName(sql, uname); if (u != null && u.getUID() > 0) { uid = u.getUID(); diff --git a/juick-www/src/main/java/com/juick/www/PM.java b/juick-www/src/main/java/com/juick/www/PM.java index f7a7f478..8190d65b 100644 --- a/juick-www/src/main/java/com/juick/www/PM.java +++ b/juick-www/src/main/java/com/juick/www/PM.java @@ -20,6 +20,7 @@ package com.juick.www; import com.juick.server.PMQueries; import com.juick.server.TagQueries; import com.juick.server.UserQueries; +import com.juick.util.UserUtils; import com.juick.xmpp.JID; import com.juick.xmpp.Message; import com.juick.xmpp.Stream; @@ -69,7 +70,7 @@ public class PM { List<com.juick.Message> msgs = PMQueries.getLastPMSent(sql, visitor.getUID()); String uname = request.getParameter("uname"); - if (!UserQueries.checkUserNameValid(uname)) { + if (!UserUtils.checkUserNameValid(uname)) { uname = ""; } @@ -92,7 +93,7 @@ public class PM { uname = uname.substring(1); } int uid = 0; - if (UserQueries.checkUserNameValid(uname)) { + if (UserUtils.checkUserNameValid(uname)) { uid = UserQueries.getUIDbyName(sql, uname); } diff --git a/juick-www/src/main/java/com/juick/www/Settings.java b/juick-www/src/main/java/com/juick/www/Settings.java index 8fe14615..6be16acc 100644 --- a/juick-www/src/main/java/com/juick/www/Settings.java +++ b/juick-www/src/main/java/com/juick/www/Settings.java @@ -23,6 +23,7 @@ import com.juick.server.TagQueries; import com.juick.server.UserQueries; import com.juick.server.helpers.NotifyOpts; import com.juick.server.helpers.UserInfo; +import com.juick.util.UserUtils; import com.mitchellbosecke.pebble.error.PebbleException; import com.mitchellbosecke.pebble.template.PebbleTemplate; import net.coobird.thumbnailator.Thumbnails; @@ -199,7 +200,7 @@ public class Settings { sql.queryForObject("SELECT authcode FROM auth WHERE user_id=? AND protocol='email' " + "AND account=?", String.class, visitor.getUID(), request.getParameter("account")); } catch (EmptyResultDataAccessException e) { - String authCode = UserQueries.generateHash(8); + String authCode = UserUtils.generateHash(8); if (sql.update("INSERT INTO auth(user_id,protocol,account,authcode) VALUES (?,'email',?,?)", visitor.getUID(), request.getParameter("account"), authCode) > 0) { Session session = Session.getDefaultInstance(System.getProperties()); |