|
@@ -7,6 +7,7 @@ import com.jeesite.common.idgen.IdGen;
|
|
|
import com.jeesite.common.lang.StringUtils;
|
|
|
import com.jeesite.common.msg.EmailUtils;
|
|
|
import com.jeesite.modules.bjflapi.AbstractController;
|
|
|
+import com.jeesite.modules.report.dto.WebsiteUserDto;
|
|
|
import com.jeesite.modules.report.entity.WebsiteUser;
|
|
|
import com.jeesite.modules.report.service.WebsiteUserService;
|
|
|
import com.jeesite.modules.report.util.JwtUtil;
|
|
@@ -133,11 +134,10 @@ public class WebsiteUserControllerApi extends AbstractController {
|
|
|
*/
|
|
|
@WebsiteAuth
|
|
|
@PostMapping(value = "updatePwd")
|
|
|
- public String updatePwd(String newPassword,
|
|
|
- String confirmNewPassword) {
|
|
|
+ public String updatePwd(WebsiteUserDto dto) {
|
|
|
String userId = getUserIdByRequest();
|
|
|
WebsiteUser websiteUser = websiteUserService.get(userId);
|
|
|
- return updatePass(websiteUser, newPassword, confirmNewPassword);
|
|
|
+ return updatePass(websiteUser, dto.getNewPassword(), dto.getConfirmNewPassword());
|
|
|
}
|
|
|
|
|
|
private String updatePass(WebsiteUser websiteUser, String newPassword, String confirmNewPassword) {
|
|
@@ -162,17 +162,18 @@ public class WebsiteUserControllerApi extends AbstractController {
|
|
|
}
|
|
|
|
|
|
@PostMapping(value = "forgetPwd")
|
|
|
- public Map<String, Object> forgetPwd(String uuid, String newPassword,
|
|
|
- String confirmNewPassword) {
|
|
|
+ public Map<String, Object> forgetPwd(WebsiteUserDto dto) {
|
|
|
String secretKey = Global.getProperty("shiro.loginSubmit.secretKey");
|
|
|
- String userId = (String) redisUtil.get(Constants.PREFIX_USER_FORGET_TOKEN + uuid);
|
|
|
+ String redisKey = Constants.PREFIX_USER_FORGET_TOKEN + dto.getUuid();
|
|
|
+ String userId = (String) redisUtil.get(redisKey);
|
|
|
if (userId == null) {
|
|
|
return R.error("链接已过期");
|
|
|
}
|
|
|
WebsiteUser websiteUser = websiteUserService.get(userId);
|
|
|
- updatePass(websiteUser, newPassword, confirmNewPassword);
|
|
|
+ updatePass(websiteUser, dto.getNewPassword(), dto.getConfirmNewPassword());
|
|
|
+ redisUtil.del(redisKey);
|
|
|
WebsiteUser newWebsiteUser = new WebsiteUser();
|
|
|
- newWebsiteUser.setPassword(newPassword);
|
|
|
+ newWebsiteUser.setPassword(dto.getNewPassword());
|
|
|
newWebsiteUser.setLoginCode(DesUtils.encode(websiteUser.getLoginCode(), secretKey));
|
|
|
return login(newWebsiteUser);
|
|
|
}
|
|
@@ -182,7 +183,8 @@ public class WebsiteUserControllerApi extends AbstractController {
|
|
|
*/
|
|
|
@PostMapping(value = "getWuValidCode")
|
|
|
@ApiOperation(value = "获取找回密码的邮件验证码")
|
|
|
- public String getWuValidCode(String email) {
|
|
|
+ public String getWuValidCode(WebsiteUserDto dto) {
|
|
|
+ String email = dto.getEmail();
|
|
|
if (StringUtils.isEmpty(email)) {
|
|
|
return "邮箱为空";
|
|
|
}
|