|
@@ -22,6 +22,7 @@ import org.redisson.api.RedissonClient;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.context.annotation.Lazy;
|
|
|
+import org.springframework.core.env.Environment;
|
|
|
import org.springframework.data.redis.core.StringRedisTemplate;
|
|
|
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
|
|
import org.springframework.stereotype.Service;
|
|
@@ -38,8 +39,11 @@ import java.util.concurrent.TimeUnit;
|
|
|
@Service
|
|
|
public class SysAuthServiceImpl implements SysAuthService {
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private Environment env;
|
|
|
@Value("${tencent.sms.debug}")
|
|
|
private String SMS_DEBUG;
|
|
|
+
|
|
|
@Autowired
|
|
|
private CountUtil countUtil;
|
|
|
|
|
@@ -108,11 +112,12 @@ public class SysAuthServiceImpl implements SysAuthService {
|
|
|
responseOutputStream.close();
|
|
|
}
|
|
|
|
|
|
- // [Method] 判断验证码是否正确
|
|
|
+ // [Method] 判断图形验证码是否正确
|
|
|
private Boolean isCaptchaValid(String captcha, String captchaRedisKey) {
|
|
|
- // 测试环境绕过验证码
|
|
|
- boolean isDevEnv = configName.contains("dev");
|
|
|
- if (!isDevEnv) {
|
|
|
+ // 如果不是本地开发环境,则执行以下判断
|
|
|
+ String profileActive = env.getProperty("spring.profiles.active");
|
|
|
+ System.out.println("spring.profiles.active: " + profileActive);
|
|
|
+ if (!("local".equals(profileActive))) {
|
|
|
// 判断验证码是否正确 (是否与Redis中的验证码匹配) (测试环境忽略)
|
|
|
String captchaRedisValue = stringRedisTemplate.opsForValue().get(captchaRedisKey);
|
|
|
if (captchaRedisValue == null || !captchaRedisValue.equalsIgnoreCase(captcha)) {
|