|
@@ -5,8 +5,6 @@ import com.usoftchina.smartschool.account.dto.AccountRegDTO;
|
|
|
import com.usoftchina.smartschool.account.po.Account;
|
|
|
import com.usoftchina.smartschool.account.service.AccountService;
|
|
|
import com.usoftchina.smartschool.base.Result;
|
|
|
-import com.usoftchina.smartschool.context.BaseContextHolder;
|
|
|
-import com.usoftchina.smartschool.exception.BizException;
|
|
|
import com.usoftchina.smartschool.exception.ExceptionCode;
|
|
|
import com.usoftchina.smartschool.utils.BeanMapper;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -103,12 +101,12 @@ public class AccountController {
|
|
|
* @return
|
|
|
*/
|
|
|
@PostMapping("/password/reset")
|
|
|
- public Result resetPassword(@RequestParam("password") String password){
|
|
|
- Account account = accountService.findByPrimaryKey(BaseContextHolder.getUserId());
|
|
|
+ public Result resetPassword(@RequestParam("password") String password, @RequestParam("userId") Long userId){
|
|
|
+ Account account = accountService.findByPrimaryKey(userId);
|
|
|
if (null == account) {
|
|
|
return Result.error(ExceptionCode.USER_NOT_EXIST);
|
|
|
}
|
|
|
- account.setId(BaseContextHolder.getUserId());
|
|
|
+ account.setId(userId);
|
|
|
account.setUser_pass(accountService.getEncryptedPassword(password, account.getSalt()));
|
|
|
accountService.updateByPrimaryKeySelective(account);
|
|
|
return Result.success();
|