From 59f5dc49446655c947e7141bf43e852290d4045c Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Wed, 6 Apr 2022 15:32:05 +0800 Subject: [PATCH] =?UTF-8?q?=E6=BC=8F=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../IRaCIS.Core.Application.xml | 8 ++++++++ .../Service/Management/UserService.cs | 17 +++++++++++++++-- 2 files changed, 23 insertions(+), 2 deletions(-) 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)