From 7125034651a228729741f14b3998a580955d97d2 Mon Sep 17 00:00:00 2001 From: "747575620@qq.com" <747575620@qq.com> Date: Thu, 31 Aug 2023 18:57:45 +0800 Subject: [PATCH] =?UTF-8?q?bug=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BPA.MES.Base.Application/BPA.MES.Base.Application.xml | 5 +++++ .../Services/SystemService/Dtos/AccountInput.cs | 6 +++++- .../Services/SystemService/Services/AuthorizeService.cs | 4 +++- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/backend/BPA.MES.Base.Application/BPA.MES.Base.Application.xml b/backend/BPA.MES.Base.Application/BPA.MES.Base.Application.xml index 86a0af5..37ed6ec 100644 --- a/backend/BPA.MES.Base.Application/BPA.MES.Base.Application.xml +++ b/backend/BPA.MES.Base.Application/BPA.MES.Base.Application.xml @@ -7561,6 +7561,11 @@ [账号信息]修改密码 + + + 旧密码 + + 新密码 diff --git a/backend/BPA.MES.Base.Application/Services/SystemService/Dtos/AccountInput.cs b/backend/BPA.MES.Base.Application/Services/SystemService/Dtos/AccountInput.cs index 787a57e..5f26c29 100644 --- a/backend/BPA.MES.Base.Application/Services/SystemService/Dtos/AccountInput.cs +++ b/backend/BPA.MES.Base.Application/Services/SystemService/Dtos/AccountInput.cs @@ -50,8 +50,12 @@ namespace BPA.MES.Base.Application /// /// [账号信息]修改密码 /// - public class AccountUpdatePwdInput: AccountInput + public class AccountUpdatePwdInput { + /// + /// 旧密码 + /// + public string OldPwd { get; set; } /// /// 新密码 /// diff --git a/backend/BPA.MES.Base.Application/Services/SystemService/Services/AuthorizeService.cs b/backend/BPA.MES.Base.Application/Services/SystemService/Services/AuthorizeService.cs index 59df812..301d584 100644 --- a/backend/BPA.MES.Base.Application/Services/SystemService/Services/AuthorizeService.cs +++ b/backend/BPA.MES.Base.Application/Services/SystemService/Services/AuthorizeService.cs @@ -49,6 +49,7 @@ { {ClaimConst.CLAINM_USERID, User.Id}, {ClaimConst.CLAINM_NAME,User.Name}, + {ClaimConst.CLAINM_ACCOUNT,Info.Account }, {ClaimConst.CLAINM_ISAUTH,User.IsAdmin}, {ClaimConst.CLAINM_ROLEID,User.RoleId } }, 43200); @@ -307,7 +308,8 @@ [HttpPost] public async Task EditAccountPwd(AccountUpdatePwdInput input) { - var model = db.Queryable().First(t => t.Account == input.Account && t.Pwd == input.Pwd); + var Account = App.User?.FindFirst(ClaimConst.CLAINM_ACCOUNT)?.Value; + var model = db.Queryable().First(t => t.Account == Account && t.Pwd == input.OldPwd); if (model == null) throw Oops.Bah("原密码不正确"); model.Pwd = input.NewPwd; return await db.Updateable(model).ExecuteCommandAsync() > 0;