2
0

feat: 邮箱验证码调整

This commit is contained in:
caiyuchao
2025-02-07 19:29:12 +08:00
parent 8e80e320f8
commit 2ef09ec104
13 changed files with 115 additions and 24 deletions

View File

@@ -115,7 +115,7 @@ public class Constants
/**
* 邮箱验证码有效期(分钟)
*/
public static final long MAIL_CAPTCHA_EXPIRATION = 30;
public static final long MAIL_CAPTCHA_EXPIRATION = 10;
/**
* 资源映射路径 前缀

View File

@@ -51,4 +51,9 @@ public class SecurityConstants
* 角色权限
*/
public static final String ROLE_PERMISSION = "role_permission";
/**
* 多语言
*/
public static final String CONTENT_LANGUAGE = "content-language";
}

View File

@@ -0,0 +1,22 @@
package org.wfc.common.core.exception;
import org.wfc.common.core.exception.user.UserException;
/**
* 验证码错误异常类
*
* @author wfc
*/
public class VerificationCodeException extends UserException
{
private static final long serialVersionUID = 1L;
public VerificationCodeException() {
super("email.code.error");
}
public VerificationCodeException(String msg)
{
super(msg);
}
}

View File

@@ -51,6 +51,7 @@ rate.limiter.message=Visit too frequently, please try again later
sms.code.not.blank=Sms code cannot be blank
sms.code.retry.limit.count=Sms code input error {0} times
sms.code.retry.limit.exceed=Sms code input error {0} times, account locked for {1} minutes
email.code.error=Verification code error
email.code.not.blank=Email code cannot be blank
email.code.retry.limit.count=Email code input error {0} times
email.code.retry.limit.exceed=Email code input error {0} times, account locked for {1} minutes

View File

@@ -51,6 +51,7 @@ rate.limiter.message=访问过于频繁,请稍候再试
sms.code.not.blank=短信验证码不能为空
sms.code.retry.limit.count=短信验证码输入错误{0}次
sms.code.retry.limit.exceed=短信验证码输入错误{0}次,帐户锁定{1}分钟
email.code.error=邮箱验证码错误
email.code.not.blank=邮箱验证码不能为空
email.code.retry.limit.count=邮箱验证码输入错误{0}次
email.code.retry.limit.exceed=邮箱验证码输入错误{0}次,帐户锁定{1}分钟

View File

@@ -1,14 +1,15 @@
package org.wfc.common.security.feign;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import feign.RequestInterceptor;
import feign.RequestTemplate;
import org.springframework.stereotype.Component;
import org.wfc.common.core.constant.SecurityConstants;
import org.wfc.common.core.utils.ServletUtils;
import org.wfc.common.core.utils.StringUtils;
import org.wfc.common.core.utils.ip.IpUtils;
import feign.RequestInterceptor;
import feign.RequestTemplate;
import javax.servlet.http.HttpServletRequest;
import java.util.Map;
/**
* feign 请求拦截器
@@ -46,6 +47,11 @@ public class FeignRequestInterceptor implements RequestInterceptor
{
requestTemplate.header(SecurityConstants.AUTHORIZATION_HEADER, authentication);
}
String language = headers.get(SecurityConstants.CONTENT_LANGUAGE);
if (StringUtils.isNotEmpty(language))
{
requestTemplate.header(SecurityConstants.CONTENT_LANGUAGE, language);
}
String platform = headers.get(SecurityConstants.DETAILS_PLATFORM);
if (StringUtils.isNotEmpty(platform)) {
requestTemplate.header(SecurityConstants.DETAILS_PLATFORM, platform);