|
@@ -156,7 +156,7 @@ public class UserProvider extends BaseProvider implements IUserService {
|
|
|
}
|
|
}
|
|
|
}else{
|
|
}else{
|
|
|
// 验证码校验
|
|
// 验证码校验
|
|
|
- captcha(requestId, username, captcha);
|
|
|
|
|
|
|
+ captcha(requestId, username, captcha, loginVo.getClientType());
|
|
|
// 用户登录
|
|
// 用户登录
|
|
|
try{
|
|
try{
|
|
|
String password = AESUtil.decryptUser(loginVo.getPassword());
|
|
String password = AESUtil.decryptUser(loginVo.getPassword());
|
|
@@ -341,9 +341,16 @@ public class UserProvider extends BaseProvider implements IUserService {
|
|
|
*
|
|
*
|
|
|
* @param requestId
|
|
* @param requestId
|
|
|
* @param account
|
|
* @param account
|
|
|
- * @param captcha
|
|
|
|
|
|
|
+ * @param captcha
|
|
|
|
|
+ * @param clientType 客户端类型,mobile时跳过验证码
|
|
|
*/
|
|
*/
|
|
|
- private void captcha(String requestId, String account, String captcha) {
|
|
|
|
|
|
|
+ private void captcha(String requestId, String account, String captcha, String clientType) {
|
|
|
|
|
+ // 移动端跳过验证码校验
|
|
|
|
|
+ if("mobile".equalsIgnoreCase(clientType)) {
|
|
|
|
|
+ logger.debug("Mobile client login, skip captcha validation.");
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
String captchaKey = appConfig.getRedisKey(RedisKey.LOGIN_CAPTCHA, RequestUtil.getIpAddr(RequestContext.getHttpServletRequest()));
|
|
String captchaKey = appConfig.getRedisKey(RedisKey.LOGIN_CAPTCHA, RequestUtil.getIpAddr(RequestContext.getHttpServletRequest()));
|
|
|
String userCaptcha = RedisUtil.redisTemplateString.opsForValue().get(captchaKey);
|
|
String userCaptcha = RedisUtil.redisTemplateString.opsForValue().get(captchaKey);
|
|
|
if(userConfig.getCaptcha().isEnabled() || (userConfig.getCaptcha().isForceEnabled() && StringUtil.isNotBlank(userCaptcha)))
|
|
if(userConfig.getCaptcha().isEnabled() || (userConfig.getCaptcha().isForceEnabled() && StringUtil.isNotBlank(userCaptcha)))
|