aboutsummaryrefslogtreecommitdiff
path: root/juick-server/src/main/java/com/juick/service/UserServiceImpl.java
diff options
context:
space:
mode:
Diffstat (limited to 'juick-server/src/main/java/com/juick/service/UserServiceImpl.java')
-rw-r--r--juick-server/src/main/java/com/juick/service/UserServiceImpl.java15
1 files changed, 15 insertions, 0 deletions
diff --git a/juick-server/src/main/java/com/juick/service/UserServiceImpl.java b/juick-server/src/main/java/com/juick/service/UserServiceImpl.java
index 0b8ed13b..1fc72525 100644
--- a/juick-server/src/main/java/com/juick/service/UserServiceImpl.java
+++ b/juick-server/src/main/java/com/juick/service/UserServiceImpl.java
@@ -141,6 +141,21 @@ public class UserServiceImpl extends BaseJdbcService implements UserService {
return null;
}
+ @Override
+ @Transactional(readOnly = true)
+ public User getUserByEmail(String email) {
+ if (StringUtils.isNotBlank(email)) {
+ List<User> list = getJdbcTemplate().query(
+ "SELECT id, nick, banned, lang FROM users WHERE id = (SELECT user_id FROM emails WHERE email = ?)",
+ new UserMapper(),
+ email);
+
+ if (!list.isEmpty())
+ return list.get(0);
+ }
+ return AnonymousUser.INSTANCE;
+ }
+
@Transactional(readOnly = true)
@Override
public List<User> getFullyUsersByNames(final Collection<String> usernames) {