👍 修复评测搜索

This commit is contained in:
2023-02-02 14:56:48 +08:00
parent bd85cca154
commit 84d4d8e118
4 changed files with 45 additions and 9 deletions
@@ -27,6 +27,7 @@ import cn.iocoder.yudao.module.system.service.user.AdminUserService;
import lombok.extern.slf4j.Slf4j;
import me.zhyd.oauth.model.AuthUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Lazy;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.security.authentication.AuthenticationManager;
@@ -83,6 +84,9 @@ public class AdminAuthServiceImpl implements AdminAuthService {
@Resource
private Validator validator;
@Value("${spring.profiles.active}")
private String profile;
@Override
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
// 获取 username 对应的 AdminUserDO
@@ -109,8 +113,10 @@ public class AdminAuthServiceImpl implements AdminAuthService {
@Override
public String login(AuthLoginReqVO reqVO, String userIp, String userAgent) {
// 判断验证码是否正确
this.verifyCaptcha(reqVO);
if ("prod".equals(profile)) {
// 判断验证码是否正确
this.verifyCaptcha(reqVO);
}
// 使用账号密码,进行登录
LoginUser loginUser = this.login0(reqVO.getUsername(), reqVO.getPassword());