|
@@ -8,6 +8,7 @@ import com.uas.sso.service.UserService;
|
|
|
import com.uas.sso.service.UserspaceService;
|
|
import com.uas.sso.service.UserspaceService;
|
|
|
import com.uas.sso.support.SystemSession;
|
|
import com.uas.sso.support.SystemSession;
|
|
|
import com.uas.sso.util.CollectionUtils;
|
|
import com.uas.sso.util.CollectionUtils;
|
|
|
|
|
+import com.uas.sso.util.MessageUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.ui.ModelMap;
|
|
import org.springframework.ui.ModelMap;
|
|
|
import org.springframework.util.StringUtils;
|
|
import org.springframework.util.StringUtils;
|
|
@@ -36,7 +37,7 @@ public class ChangeAdminController extends BaseController {
|
|
|
private ChangeAdminService changeAdminService;
|
|
private ChangeAdminService changeAdminService;
|
|
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
|
- private static final String STEP_SECONT_TOKEN = "changeAdmin";
|
|
|
|
|
|
|
+ private static final String PREPARE_TOKEN = "changeAdmin";
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 获取校验类型
|
|
* 获取校验类型
|
|
@@ -131,22 +132,17 @@ public class ChangeAdminController extends BaseController {
|
|
|
UserAccount userAccount = SystemSession.getUserAccount();
|
|
UserAccount userAccount = SystemSession.getUserAccount();
|
|
|
|
|
|
|
|
// 设置发送邮件信息
|
|
// 设置发送邮件信息
|
|
|
|
|
+ User user = userService.findOne(userAccount.getUserUU());
|
|
|
Token existToken = new Token(userAccount, 7 * 24 * 60 * 60);
|
|
Token existToken = new Token(userAccount, 7 * 24 * 60 * 60);
|
|
|
tokenService.save(existToken);
|
|
tokenService.save(existToken);
|
|
|
ModelMap data = new ModelMap();
|
|
ModelMap data = new ModelMap();
|
|
|
- data.put("vipName", userAccount.getVipName());
|
|
|
|
|
|
|
+ data.put("vipName", user.getVipName());
|
|
|
data.put("type", "更换管理员");
|
|
data.put("type", "更换管理员");
|
|
|
// TODO 邮件认证地址
|
|
// TODO 邮件认证地址
|
|
|
data.put("url", url + (url.contains("?") ? "&" : "?") + "token=" + existToken.getId());
|
|
data.put("url", url + (url.contains("?") ? "&" : "?") + "token=" + existToken.getId());
|
|
|
|
|
|
|
|
// 发送邮件
|
|
// 发送邮件
|
|
|
- String email = userAccount.getEmail();
|
|
|
|
|
- if (!StringUtils.isEmpty(email)) {
|
|
|
|
|
- Setting mailTplId = settingService.findOne("templateForSendMailWhenResetPassword");
|
|
|
|
|
- if (!StringUtils.isEmpty(mailTplId)) {
|
|
|
|
|
- mailService.send(mailTplId.getValue(), email, data);
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ MessageUtils.sendEmail("templateForSendMailWhenResetPassword", user.getEmail(), data);
|
|
|
|
|
|
|
|
// 设置返回值
|
|
// 设置返回值
|
|
|
request.getSession().setAttribute("existToken", existToken);
|
|
request.getSession().setAttribute("existToken", existToken);
|