ZQN
2024-06-19 72468556f3709380ab3a70e07d8a916fbd47c988
project-framework/src/main/java/com/project/framework/web/service/SysLoginService.java
@@ -1,7 +1,5 @@
package com.project.framework.web.service;
import javax.annotation.Resource;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject;
import com.aliyuncs.CommonRequest;
@@ -13,23 +11,13 @@
import com.aliyuncs.profile.DefaultProfile;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.project.common.constant.AliyunSmsConstants;
import com.project.common.exception.base.BaseException;
import com.project.system.domain.bo.editBo.UserPhoneLoginBo;
import com.project.system.mapper.SysUserMapper;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.authentication.BadCredentialsException;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.stereotype.Component;
import com.project.common.constant.CacheConstants;
import com.project.common.constant.Constants;
import com.project.common.core.domain.entity.SysUser;
import com.project.common.core.domain.model.LoginUser;
import com.project.common.core.redis.RedisCache;
import com.project.common.exception.ServiceException;
import com.project.common.exception.base.BaseException;
import com.project.common.exception.user.CaptchaException;
import com.project.common.exception.user.CaptchaExpireException;
import com.project.common.exception.user.UserPasswordNotMatchException;
@@ -41,8 +29,17 @@
import com.project.framework.manager.AsyncManager;
import com.project.framework.manager.factory.AsyncFactory;
import com.project.framework.security.context.AuthenticationContextHolder;
import com.project.system.domain.bo.editBo.UserPhoneLoginBo;
import com.project.system.mapper.SysUserMapper;
import com.project.system.service.ISysConfigService;
import com.project.system.service.ISysUserService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.authentication.BadCredentialsException;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.stereotype.Component;
import java.util.Random;
import java.util.concurrent.TimeUnit;
@@ -237,7 +234,7 @@
     * @param code  验证码
     * @return  校验结果
     */
    private Boolean verifyPhone(String phone, String code)
    public Boolean verifyPhone(String phone, String code)
    {
        String key = getCacheKey(phone);
        if (!redisCache.hasKey(key)) {