whyclxw
2024-04-28 b25b814a949d2065a61fd3167206ffb51a57af65
src/main/java/com/whyc/service/LoginService.java
@@ -17,6 +17,7 @@
import com.whyc.util.MessageUtils;
import com.whyc.util.RSAUtil;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authc.AuthenticationException;
import org.apache.shiro.authc.UsernamePasswordToken;
import org.apache.shiro.subject.Subject;
import org.springframework.beans.factory.annotation.Autowired;
@@ -260,6 +261,8 @@
                }
                CommonUtil.record(0, UserOperation.TYPE_LOGIN_FAIL.getType(), UserOperation.TYPE_LOGIN_FAIL.getTypeName(), UserOperation.TYPE_LOGIN_FAIL.getTypeNameEn());
                return response.set(1, false, MessageUtils.getMessage("AccountOrPasswordError"));
            }else if(e instanceof AuthenticationException){
                return response.set(1, false, "密码解析失败");
            }
            return response.set(1, false, message);
        }
@@ -286,7 +289,7 @@
            dataList.add(subject.getPrincipal());
            PermitGroupUser permitGroup = permitGroupUserService.getPermitGroup(userInf.getUId());
            if(permitGroup == null){
                return new Response().set(1, false, MessageUtils.getMessage("userNoPermitGroup"));
                return response.set(1, false, MessageUtils.getMessage("userNoPermitGroup"));
            }else {
                int permitGroupId = permitGroup.getPermitGroupId();
                dataList.add(permitGroupId);
@@ -297,9 +300,9 @@
            String mapName = mapOutlineService.selectMapName();
            dataList.add(mapName);
            CommonUtil.record(((UserInf) subject.getPrincipal()).getUId(), UserOperation.TYPE_LOGIN.getType(), UserOperation.TYPE_LOGIN.getTypeName(), UserOperation.TYPE_LOGIN.getTypeNameEn());
            return new Response<>().setII(1, true, dataList, MessageUtils.getMessage("LoginSucceeded"));
            return response.setII(1, true, dataList, MessageUtils.getMessage("LoginSucceeded"));
        }
        return new Response().set(1, false, MessageUtils.getMessage("AuthenticationFailed"));
        return response.set(1, false, MessageUtils.getMessage("AuthenticationFailed"));
    }
    // 将所有登陆的用户的信息存到application中