Merge branch 'main' of https://dd3skj.picp.vip/zhaoxinyu/zhgh_njnu
# Conflicts: # src/main/java/com/budwk/app/sys/services/impl/SysUserServiceImpl.java
This commit is contained in:
@@ -90,7 +90,7 @@ public class SysLoginController {
|
|||||||
HttpServletRequest req, HttpServletResponse response, HttpSession session) {
|
HttpServletRequest req, HttpServletResponse response, HttpSession session) {
|
||||||
try {
|
try {
|
||||||
Sys_user user = null;
|
Sys_user user = null;
|
||||||
sysUserService.checkLoginname(username);
|
// sysUserService.checkLoginname(username);
|
||||||
validateService.checkCode(captchaKey, captchaCode);
|
validateService.checkCode(captchaKey, captchaCode);
|
||||||
user = sysUserService.loginByPassword(username, password);
|
user = sysUserService.loginByPassword(username, password);
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
|
|||||||
@@ -298,7 +298,9 @@ public class SysUserServiceImpl extends BaseServiceImpl<Sys_user> implements Sys
|
|||||||
public Sys_user loginByPassword(String loginname, String passowrd) throws BaseException {
|
public Sys_user loginByPassword(String loginname, String passowrd) throws BaseException {
|
||||||
Sys_user user = this.fetch(Cnd.where("loginname", "=", loginname));
|
Sys_user user = this.fetch(Cnd.where("loginname", "=", loginname));
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
throw new BaseException("用户不存在");
|
// throw new BaseException("用户不存在");
|
||||||
|
// 防止暴力破解
|
||||||
|
throw new BaseException("用户名或者密码不正确");
|
||||||
}
|
}
|
||||||
if (user.isDisabled()) {
|
if (user.isDisabled()) {
|
||||||
throw new BaseException("用户被禁用");
|
throw new BaseException("用户被禁用");
|
||||||
@@ -307,7 +309,7 @@ public class SysUserServiceImpl extends BaseServiceImpl<Sys_user> implements Sys
|
|||||||
String decodePwd = Base64Decoder.decodeStr(passowrd);
|
String decodePwd = Base64Decoder.decodeStr(passowrd);
|
||||||
String hashedPassword = PwdUtil.getPassword(decodePwd, user.getSalt());
|
String hashedPassword = PwdUtil.getPassword(decodePwd, user.getSalt());
|
||||||
if (!Strings.sNull(hashedPassword).equalsIgnoreCase(user.getPassword())) {
|
if (!Strings.sNull(hashedPassword).equalsIgnoreCase(user.getPassword())) {
|
||||||
throw new BaseException("密码不正确");
|
throw new BaseException("用户名或者密码不正确");
|
||||||
}
|
}
|
||||||
user = this.fetchLinks(user, "unit");
|
user = this.fetchLinks(user, "unit");
|
||||||
if (Lang.isNotEmpty(user.getUnit()) && StrUtil.isNotBlank(user.getUnit().getUnionId())) {
|
if (Lang.isNotEmpty(user.getUnit()) && StrUtil.isNotBlank(user.getUnit().getUnionId())) {
|
||||||
|
|||||||
Reference in New Issue
Block a user