|
@@ -15,14 +15,7 @@ import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
-import org.springframework.web.bind.annotation.DeleteMapping;
|
|
|
-import org.springframework.web.bind.annotation.GetMapping;
|
|
|
-import org.springframework.web.bind.annotation.PathVariable;
|
|
|
-import org.springframework.web.bind.annotation.PostMapping;
|
|
|
-import org.springframework.web.bind.annotation.PutMapping;
|
|
|
-import org.springframework.web.bind.annotation.RequestBody;
|
|
|
-import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
-import org.springframework.web.bind.annotation.RestController;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
import com.boman.domain.constant.UserConstants;
|
|
|
import com.boman.domain.dto.R;
|
|
@@ -276,6 +269,34 @@ public class SysUserController extends BaseController {
|
|
|
return toAjax(userService.resetPwd(user));
|
|
|
}
|
|
|
|
|
|
+ @PutMapping("/resetPwdLogin")
|
|
|
+ public AjaxResult resetPwdLogin(@RequestParam("userName") String userName,@RequestParam("oldPassword") String oldPassword,@RequestParam("newPassword") String newPassword) {
|
|
|
+ //userService.checkUserAllowed(user);
|
|
|
+ if ("admin".equals(userName)){
|
|
|
+ return AjaxResult.error("不允许操作超级管理员");
|
|
|
+ }
|
|
|
+ SysUser user = userService.selectUserByUserName(userName);
|
|
|
+ if (user == null){
|
|
|
+ return AjaxResult.error("当前用户不存在");
|
|
|
+ }
|
|
|
+ String password = user.getPassword();
|
|
|
+ if (!SecurityUtils.matchesPassword(oldPassword, password))
|
|
|
+ {
|
|
|
+ return AjaxResult.error("修改密码失败,旧密码错误");
|
|
|
+ }
|
|
|
+ if (SecurityUtils.matchesPassword(newPassword, password))
|
|
|
+ {
|
|
|
+ return AjaxResult.error("新密码不能与旧密码相同");
|
|
|
+ }
|
|
|
+
|
|
|
+ if ("1".equals(checkStrongPwd(newPassword))) {
|
|
|
+ return AjaxResult.error("密码必须包含数字、大小写字母、特殊符号且大于8位");
|
|
|
+ }
|
|
|
+ user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
|
|
|
+ user.setUpdateBy(userName);
|
|
|
+ return toAjax(userService.resetPwdLogin(user));
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 状态修改
|
|
|
*/
|