Commit 1d9b24e8 authored by zengtianlai3's avatar zengtianlai3

解决邮件轰炸

parent b15347dd
...@@ -139,6 +139,10 @@ public class LoginController { ...@@ -139,6 +139,10 @@ public class LoginController {
@ApiOperation(value = "发送验证码", notes = "发送验证码到邮箱") @ApiOperation(value = "发送验证码", notes = "发送验证码到邮箱")
@GetMapping("send_code") @GetMapping("send_code")
public BaseResult sendCode() { public BaseResult sendCode() {
Date emailCodeExpTime = UserUtils.getEmailCodeExpTime(account);
if (emailCodeExpTime != null && emailCodeExpTime.after(new Date())) {
return BaseResult.failed().setMsgValue("验证码还在有效期内");
}
String code = CommonUtil.getValidateCode(); String code = CommonUtil.getValidateCode();
String content = "感谢您使用实名制服务器" + "\n" + "此次登录验证码为:" + code + "(有效期三分钟)。验证码提供给他人可能导致账号被盗,请勿转发或泄露。" + "\n" + "--------------------------------------------------------------" + "此邮件由系统自动发送,请勿回复此邮件" + "--------------------------------------------------------------"; String content = "感谢您使用实名制服务器" + "\n" + "此次登录验证码为:" + code + "(有效期三分钟)。验证码提供给他人可能导致账号被盗,请勿转发或泄露。" + "\n" + "--------------------------------------------------------------" + "此邮件由系统自动发送,请勿回复此邮件" + "--------------------------------------------------------------";
emailUtils.sendSimpleMail(account, "感谢您使用实名制服务器", content); emailUtils.sendSimpleMail(account, "感谢您使用实名制服务器", content);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment