aboutsummaryrefslogtreecommitdiff
path: root/juick-server/src/main/java/com/juick/service/EmailServiceImpl.java
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2018-09-06 13:58:40 +0300
committerGravatar Vitaly Takmazov2018-09-07 05:15:51 -0400
commit670913698776e09b7ff44f44ccdcf56303d79be3 (patch)
tree96f932645ab0faf9de6861f89072d1eb4b2622a3 /juick-server/src/main/java/com/juick/service/EmailServiceImpl.java
parent51489a954463567f8dd50854826c03ce51c45cb3 (diff)
merge legacy www
Diffstat (limited to 'juick-server/src/main/java/com/juick/service/EmailServiceImpl.java')
-rw-r--r--juick-server/src/main/java/com/juick/service/EmailServiceImpl.java16
1 files changed, 16 insertions, 0 deletions
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);
+ }
+
}