diff options
author | Vitaly Takmazov | 2024-01-21 16:06:54 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2024-01-21 16:08:30 +0300 |
commit | 4bca09435335528bbce1e8f4579fbaa9d6150ed1 (patch) | |
tree | de78023db8b2278607bdee135b935582997dfef8 /src/main/java/com/juick/service | |
parent | 8c00749401b0c2544b438b5f9b8a77a447400b0a (diff) |
Delete login hash on logout
Diffstat (limited to 'src/main/java/com/juick/service')
-rw-r--r-- | src/main/java/com/juick/service/UserService.java | 2 | ||||
-rw-r--r-- | src/main/java/com/juick/service/UserServiceImpl.java | 6 |
2 files changed, 8 insertions, 0 deletions
diff --git a/src/main/java/com/juick/service/UserService.java b/src/main/java/com/juick/service/UserService.java index 9313bba90..6f7cb58f4 100644 --- a/src/main/java/com/juick/service/UserService.java +++ b/src/main/java/com/juick/service/UserService.java @@ -122,6 +122,8 @@ public interface UserService { List<String> getEmails(User user); + void logout(int uid); + boolean deleteJID(int uid, String jid); boolean unauthJID(int uid, String jid); diff --git a/src/main/java/com/juick/service/UserServiceImpl.java b/src/main/java/com/juick/service/UserServiceImpl.java index 2f03c5bf8..812a4e8b3 100644 --- a/src/main/java/com/juick/service/UserServiceImpl.java +++ b/src/main/java/com/juick/service/UserServiceImpl.java @@ -596,6 +596,12 @@ public class UserServiceImpl extends BaseJdbcService implements UserService { @Transactional @Override + public void logout(int uid) { + getJdbcTemplate().update("DELETE FROM logins WHERE user_id=?", uid); + } + + @Transactional + @Override public boolean deleteJID(int uid, String jid) { return getNamedParameterJdbcTemplate().update("DELETE FROM jids " + "WHERE (SELECT COUNT(*) cnt FROM (select user_id, jid FROM jids j) c WHERE user_id=:uid) > 1 " + |