diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml index 466f53f7a..2864205dd 100644 --- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml +++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml @@ -2058,6 +2058,14 @@ + + + (未登陆) 设置新密码 + + + + + diff --git a/IRaCIS.Core.Application/Service/Management/UserService.cs b/IRaCIS.Core.Application/Service/Management/UserService.cs index e7d43d42e..fe795cb18 100644 --- a/IRaCIS.Core.Application/Service/Management/UserService.cs +++ b/IRaCIS.Core.Application/Service/Management/UserService.cs @@ -161,8 +161,16 @@ namespace IRaCIS.Application.Services /// [HttpGet("{userId:guid}")] - public async Task ResetPassword(Guid userId + public async Task ResetPassword(Guid userId) + { + var success = await _userRepository.UpdateFromQueryAsync(t => t.Id == userId, u => new User() + { + Password = MD5Helper.Md5(StaticData.DefaultPassword), + PasswordChanged = false + }); + return ResponseOutput.Result(success); + } @@ -247,7 +255,12 @@ namespace IRaCIS.Application.Services } - + /// + /// (未登陆) 设置新密码 + /// + /// + /// + /// [AllowAnonymous] [HttpGet("{userId:guid}/{newPwd}")] public async Task AnonymousSetPassword(Guid userId, string newPwd)