| | |
| | | import org.springframework.security.core.Authentication;
|
| | | import org.springframework.stereotype.Component;
|
| | | import com.ruoyi.common.constant.CacheConstants;
|
| | | import com.ruoyi.common.constant.Constants;
|
| | | import com.ruoyi.common.exception.user.UserPasswordNotMatchException;
|
| | | import com.ruoyi.common.exception.user.UserPasswordRetryLimitExceedException;
|
| | | import com.ruoyi.common.utils.MessageUtils;
|
| | | import com.ruoyi.common.utils.SecurityUtils;
|
| | | import com.ruoyi.framework.manager.AsyncManager;
|
| | | import com.ruoyi.framework.manager.factory.AsyncFactory;
|
| | | import com.ruoyi.framework.redis.RedisCache;
|
| | | import com.ruoyi.framework.security.context.AuthenticationContextHolder;
|
| | | import com.ruoyi.project.system.domain.SysUser;
|
| | |
| | |
|
| | | if (retryCount >= Integer.valueOf(maxRetryCount).intValue())
|
| | | {
|
| | | AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL,
|
| | | MessageUtils.message("user.password.retry.limit.exceed", maxRetryCount, lockTime)));
|
| | | throw new UserPasswordRetryLimitExceedException(maxRetryCount, lockTime);
|
| | | }
|
| | |
|
| | | if (!matches(user, password))
|
| | | {
|
| | | retryCount = retryCount + 1;
|
| | | AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL,
|
| | | MessageUtils.message("user.password.retry.limit.count", retryCount)));
|
| | | redisCache.setCacheObject(getCacheKey(username), retryCount, lockTime, TimeUnit.MINUTES);
|
| | | throw new UserPasswordNotMatchException();
|
| | | }
|