后台-session过期时间

This commit is contained in:
khalil
2023-10-19 18:23:44 +08:00
parent 8047739b9e
commit 2abe8c4fb9
2 changed files with 27 additions and 6 deletions

View File

@@ -0,0 +1,24 @@
package com.accompany.flowteam.admin.config;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.jdbc.core.JdbcTemplate;
import javax.sql.DataSource;
/**
* @author: liaozetao
* @date: 2023/9/16 15:06
* @description:
*/
@Configuration
public class JdbcConfig {
@Bean
public JdbcTemplate jdbcTemplate(@Autowired DataSource dataSource) {
JdbcTemplate jdbcTemplate = new JdbcTemplate();
jdbcTemplate.setDataSource(dataSource);
return jdbcTemplate;
}
}

View File

@@ -78,10 +78,6 @@ public class LoginController extends BaseController {
getResponse().addCookie(cookie1);
getResponse().addCookie(cookie2);
getResponse().addCookie(cookie3);
// 设置session过期时间单位秒
request.getSession().setMaxInactiveInterval(60 * 60);
int maxInactiveInterval = request.getSession().getMaxInactiveInterval();
System.out.println("maxInactiveInterval :" + maxInactiveInterval);
// adminUserService.updateLastLogin(adminUser.getId());
jedisService.hset(RedisKey.flow_team_admin_httpsession_store.getKey(), account, getRequest().getSession().getId());
String smsCode = flowTeamAdminUserService.updateLoginRecord(account);
@@ -187,11 +183,12 @@ public class LoginController extends BaseController {
if (BlankUtil.isBlank(authCode)) {
return false;
}
String smsCode = jedisService.get(RedisKey.flow_team_admin_sms_code.getKey(account));
return true;
/*String smsCode = jedisService.get(RedisKey.flow_team_admin_sms_code.getKey(account));
return Optional.ofNullable(smsCode)
.map(MD5::getMD5)
.map(sc -> sc.equals(authCode))
.orElse(false);
.orElse(false);*/
}
private String accountFilter(String account) {