From 670913698776e09b7ff44f44ccdcf56303d79be3 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Thu, 6 Sep 2018 13:58:40 +0300 Subject: merge legacy www --- .../main/java/com/juick/service/EmailServiceImpl.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'juick-server/src/main/java/com/juick/service') diff --git a/juick-server/src/main/java/com/juick/service/EmailServiceImpl.java b/juick-server/src/main/java/com/juick/service/EmailServiceImpl.java index 0cccc915..5ba44e24 100644 --- a/juick-server/src/main/java/com/juick/service/EmailServiceImpl.java +++ b/juick-server/src/main/java/com/juick/service/EmailServiceImpl.java @@ -89,4 +89,20 @@ public class EmailServiceImpl extends BaseJdbcService implements EmailService { return getJdbcTemplate().queryForList("SELECT email FROM emails WHERE user_id=? " + (active ? "AND subscr_hour IS NOT NULL" : ""), String.class, userId); } + @Transactional(readOnly = true) + @Override + public String getEmailByAuthCode(String code) { + try { + return getJdbcTemplate().queryForObject("SELECT account FROM auth WHERE protocol='email' AND authcode=?", String.class, code); + } catch (EmptyResultDataAccessException e) { + return StringUtils.EMPTY; + } + } + + @Transactional + @Override + public void deleteAuthCode(String code) { + getJdbcTemplate().update("DELETE FROM auth WHERE authcode=?", code); + } + } -- cgit v1.2.3