update m2pool 谷歌绑定和谷歌解绑验证码改用html模版
This commit is contained in:
@@ -21,11 +21,14 @@ import com.m2pool.pool.vo.GoogleCloseVo;
|
||||
import com.m2pool.system.api.RemoteMailService;
|
||||
import com.m2pool.system.api.entity.EmailCodeEntity;
|
||||
import com.m2pool.system.api.entity.EmailEntity;
|
||||
import com.m2pool.system.api.entity.EmailTemplateEntity;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
@@ -334,14 +337,19 @@ public class GoogleAuthServiceImpl implements GoogleAuthService {
|
||||
}
|
||||
|
||||
public AjaxResult sendEmail(String email,String code){
|
||||
String text = "您正在绑定谷歌验证器!\n" +
|
||||
"您的邮箱验证验证码是:\n\t"+code +
|
||||
"\n此验证码10分钟有效。";
|
||||
EmailEntity emailEntity = new EmailEntity();
|
||||
emailEntity.setEmail(email);
|
||||
emailEntity.setSubject("[M2Pool] 邮箱验证码");
|
||||
emailEntity.setText(text);
|
||||
R<?> r = mailService.sendTextMail(emailEntity);
|
||||
//String text = "您正在绑定谷歌验证器!\n" +
|
||||
// "您的邮箱验证验证码是:\n\t"+code +
|
||||
// "\n此验证码10分钟有效。";
|
||||
//EmailEntity emailEntity = new EmailEntity();
|
||||
//emailEntity.setEmail(email);
|
||||
//emailEntity.setSubject("[M2Pool] 邮箱验证码");
|
||||
//emailEntity.setText(text);
|
||||
|
||||
Map<String, Object> content = new HashMap<>();
|
||||
content.put("code",code);
|
||||
content.put("text"," verification code is valid for 10 minutes,email verification code");
|
||||
EmailTemplateEntity entity = new EmailTemplateEntity(email,"You are binding Google Authenticator","emailCode-en",content);
|
||||
R<?> r = mailService.sendHtmlMailMessage(entity);
|
||||
if(r.getCode() == 200){
|
||||
return AjaxResult.success();
|
||||
}else {
|
||||
@@ -351,16 +359,23 @@ public class GoogleAuthServiceImpl implements GoogleAuthService {
|
||||
|
||||
|
||||
|
||||
|
||||
public AjaxResult sendCloseEmail(String email,String code){
|
||||
String text = "M2Pool:\n" +
|
||||
"您正在解绑谷歌验证器!\n" +
|
||||
"您的邮箱验证验证码是:\n\t"+code +
|
||||
"\n此验证码10分钟有效。";
|
||||
EmailEntity emailEntity = new EmailEntity();
|
||||
emailEntity.setEmail(email);
|
||||
emailEntity.setSubject("[M2Pool] 邮箱验证码");
|
||||
emailEntity.setText(text);
|
||||
R<?> r = mailService.sendTextMail(emailEntity);
|
||||
//String text = "M2Pool:\n" +
|
||||
// "您正在解绑谷歌验证器!\n" +
|
||||
// "您的邮箱验证验证码是:\n\t"+code +
|
||||
// "\n此验证码10分钟有效。";
|
||||
//EmailEntity emailEntity = new EmailEntity();
|
||||
//emailEntity.setEmail(email);
|
||||
//emailEntity.setSubject("[M2Pool] 邮箱验证码");
|
||||
//emailEntity.setText(text);
|
||||
|
||||
Map<String, Object> content = new HashMap<>();
|
||||
content.put("code",code);
|
||||
content.put("text"," verification code is valid for 10 minutes,email verification code");
|
||||
EmailTemplateEntity entity = new EmailTemplateEntity(email,"You are unbinding Google Authenticator","emailCode-en",content);
|
||||
|
||||
R<?> r = mailService.sendHtmlMailMessage(entity);
|
||||
if(r.getCode() == 200){
|
||||
return AjaxResult.success();
|
||||
}else {
|
||||
|
||||
Reference in New Issue
Block a user