更新修改密码

This commit is contained in:
lzw
2021-10-18 21:54:40 +08:00
parent 06fa117004
commit 135b9148b3
4 changed files with 26 additions and 14 deletions

View File

@@ -8,6 +8,7 @@ using Yi.Framework.Common;
using Yi.Framework.Common.Helper;
using Yi.Framework.Common.Models;
using Yi.Framework.Core;
using Yi.Framework.DTOModel;
using Yi.Framework.Interface;
using Yi.Framework.Model.Models;
@@ -100,5 +101,18 @@ namespace Yi.Framework.ApiMicroservice.Controllers
}
// 邮箱和验证码都要被记住,然后注册时候比对邮箱和验证码是不是都和现在生成的一样
}
[HttpPut]
public async Task<Result> ChangePassword(ChangePwdDto pwdDto)
{
var user_data = await _userService.GetEntityById(pwdDto.id);
if (user_data.password == pwdDto.newPassword)
{
user_data.password = pwdDto.newPassword;
await _userService.UpdateAsync(user_data);
return Result.Success();
}
return Result.Error();
}
}
}