|
@@ -5,7 +5,6 @@ import com.nokia.hb.Pojo.RetData;
|
|
|
import com.nokia.hb.Pojo.TreeNode;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
-import org.springframework.util.DigestUtils;
|
|
|
import org.springframework.util.StringUtils;
|
|
|
|
|
|
import javax.servlet.http.HttpSession;
|
|
@@ -576,26 +575,24 @@ public class DbUtil {
|
|
|
// }
|
|
|
|
|
|
public static Object userLogin(String username, String password, HttpSession session) {
|
|
|
- // 计算密码md5
|
|
|
- String passwordMd5 = DigestUtils.md5DigestAsHex(password.getBytes());
|
|
|
- log.debug("username: {}, password: {}, passwordMd5: {}", username, password, passwordMd5);
|
|
|
+ log.debug("username: {}, password: {}", username, password);
|
|
|
// 查询用户信息
|
|
|
String sql = "select * from pm_parse.user where username='" + username + "'";
|
|
|
- PreparedStatement psmt = null;
|
|
|
+ PreparedStatement psmt;
|
|
|
try {
|
|
|
psmt = conn.prepareStatement(sql);
|
|
|
psmt.setQueryTimeout(60 * 10);
|
|
|
ResultSet rs = psmt.executeQuery();
|
|
|
// 没有查到数据
|
|
|
if (!rs.next()) {
|
|
|
- return 0;
|
|
|
+ return "用户名或密码错误!";
|
|
|
}
|
|
|
|
|
|
String passwordStore = rs.getString("password");
|
|
|
log.debug("passwordStore: {}", passwordStore);
|
|
|
// 密码错误
|
|
|
- if (!passwordMd5.equals(passwordStore)) {
|
|
|
- return 0;
|
|
|
+ if (!password.equals(passwordStore)) {
|
|
|
+ return "用户名或密码错误!";
|
|
|
}
|
|
|
|
|
|
// 查询地区权限
|
|
@@ -614,10 +611,10 @@ public class DbUtil {
|
|
|
session.setMaxInactiveInterval(30 * 60);
|
|
|
session.setAttribute("username", username);
|
|
|
session.setAttribute("areas", map);
|
|
|
- return 1;
|
|
|
+ return null;
|
|
|
} catch (SQLException e) {
|
|
|
e.printStackTrace();
|
|
|
- return 0;
|
|
|
+ return "数据库异常!";
|
|
|
}
|
|
|
}
|
|
|
|