Commit e5690dce authored by Quxl's avatar Quxl

优化

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