Commit e5690dce authored by Quxl's avatar Quxl

优化

parent f7abffa4
......@@ -19,6 +19,7 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter
import com.egolm.film.config.interceptor.AdminLoginInterceptor;
import com.egolm.film.config.interceptor.LocaleSessionInterceptor;
import com.egolm.film.config.interceptor.MemberLoginInterceptor;
import com.egolm.film.config.interceptor.UserLoginInterceptor;
@Configuration
......@@ -31,7 +32,7 @@ public class WebMvcConfig extends WebMvcConfigurerAdapter {
private UserLoginInterceptor userLoginInterceptor;
@Autowired
private UserLoginInterceptor memberLoginInterceptor;
private MemberLoginInterceptor memberLoginInterceptor;
@Autowired
private LocaleSessionInterceptor localeSessionInterceptor;
......@@ -42,6 +43,7 @@ public class WebMvcConfig extends WebMvcConfigurerAdapter {
registry.addInterceptor(adminLoginInterceptor).addPathPatterns("/admin/**").excludePathPatterns("/admin/login");
registry.addInterceptor(userLoginInterceptor).addPathPatterns("/user/**").excludePathPatterns("/user/login");
registry.addInterceptor(memberLoginInterceptor).addPathPatterns("/member/**").excludePathPatterns("/member/login");
}
@Override
......
......@@ -28,9 +28,9 @@ public class MemberTokenServiceImpl implements MemberTokenService {
@Override
public LoginToken doLogin(String username, String password) {
HttpSession session = WebMvcConfig.getSession();
String md5String = StringUtil.toMD5HexString(password);
String loginSql = "select * from fc_member where username = ? and password = ?";
List<Map<String, Object>> list = this.jdbcTemplate.queryForList(loginSql, username, md5String);
String md5String = StringUtil.toMD5HexString(password).toLowerCase();
String loginSql = "select * from fc_member where (username = ? or email = ?) and password = ?";
List<Map<String, Object>> list = this.jdbcTemplate.queryForList(loginSql, username, username, md5String);
if(list != null) {
if(list.size() == 1) {
Map<String,Object> map = list.get(0);
......
......@@ -24,7 +24,7 @@ public class UserTokenServiceImpl implements UserTokenService {
@Override
public LoginToken doLogin(String username, String password) {
HttpSession session = WebMvcConfig.getSession();
String md5String = StringUtil.toMD5HexString(password);
String md5String = StringUtil.toMD5HexString(password).toLowerCase();
String loginSql = "select * from fc_user where username = ? and password = ?";
List<Map<String, Object>> list = this.jdbcTemplate.queryForList(loginSql, username, md5String);
if(list != null) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment