| | |
| | | package com.ruoyi.system.controller; |
| | | |
| | | import java.util.Arrays; |
| | | |
| | | import com.ruoyi.system.service.ISysUserService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | 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.RequestParam; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.common.core.utils.file.FileTypeUtils; |
| | |
| | | import com.ruoyi.system.api.domain.SysFile; |
| | | import com.ruoyi.system.api.domain.SysUser; |
| | | import com.ruoyi.system.api.model.LoginUser; |
| | | import com.ruoyi.system.dto.UpdatePassword; |
| | | import com.ruoyi.system.service.ISysUserService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.util.Arrays; |
| | | |
| | | /** |
| | | * 个人信息 业务处理 |
| | |
| | | @ApiOperation(value = "个人信息-修改密码") |
| | | @Log(title = "个人信息", businessType = BusinessType.UPDATE) |
| | | @PostMapping("/updatePwd") |
| | | public AjaxResult updatePwd(String oldPassword, String newPassword) |
| | | public AjaxResult updatePwd(@RequestBody UpdatePassword updatePassword) |
| | | { |
| | | String newPassword = updatePassword.getNewPassword(); |
| | | String oldPassword = updatePassword.getOldPassword(); |
| | | String username = updatePassword.getUsername(); |
| | | System.err.println(oldPassword); |
| | | System.err.println(newPassword); |
| | | String username = SecurityUtils.getUsername(); |
| | | // String username = SecurityUtils.getUsername(); |
| | | SysUser user = userService.selectUserByUserName(username); |
| | | String password = user.getPassword(); |
| | | if (!SecurityUtils.matchesPassword(oldPassword, password)) |
| | |
| | | // tokenService.setLoginUser(loginUser); |
| | | return success(); |
| | | } |
| | | |
| | | return error("修改密码异常,请联系管理员"); |
| | | } |
| | | |