xf 2 年之前
父节点
当前提交
4471c57494
共有 2 个文件被更改,包括 19 次插入2 次删除
  1. 4 2
      src/Hotline.Api/Controllers/UserController.cs
  2. 15 0
      src/Hotline.Share/Dtos/User/ChangePasswordDto.cs

+ 4 - 2
src/Hotline.Api/Controllers/UserController.cs

@@ -268,9 +268,11 @@ public class UserController : BaseController
     /// <param name="dto"></param>
     /// <returns></returns>
     [HttpPost("change-pwd")]
-    public async Task ChangePassword([FromBody] UserChangePasswordDto dto)
+    public async Task ChangePassword([FromBody] ChangePasswordDto dto)
     {
-        var changepwdRsp = await _identityClient.ChangePasswordAsync(dto, HttpContext.RequestAborted);
+        var changepwdDto = _mapper.Map<UserChangePasswordDto>(dto);
+        changepwdDto.UserId = _sessionContext.RequiredUserId;
+        var changepwdRsp = await _identityClient.ChangePasswordAsync(changepwdDto, HttpContext.RequestAborted);
         CheckHttpRequestSuccess(changepwdRsp, "ChangePasswordAsync");
     }
 

+ 15 - 0
src/Hotline.Share/Dtos/User/ChangePasswordDto.cs

@@ -0,0 +1,15 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Hotline.Share.Dtos.User
+{
+    public class ChangePasswordDto
+    {
+        public string Password { get; set; }
+        
+        public string ConfirmPassword { get; set; }
+    }
+}