From c2f958d0105c9f06c9a4384cae86a7a2d5bc847f Mon Sep 17 00:00:00 2001 From: liangshiwei Date: Wed, 9 Jun 2021 17:05:55 +0800 Subject: [PATCH] Change current tenant when reset password --- .../Pages/Account/ResetPassword.cshtml.cs | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/modules/account/src/Volo.Abp.Account.Web/Pages/Account/ResetPassword.cshtml.cs b/modules/account/src/Volo.Abp.Account.Web/Pages/Account/ResetPassword.cshtml.cs index c961fe7e14..c0cd463924 100644 --- a/modules/account/src/Volo.Abp.Account.Web/Pages/Account/ResetPassword.cshtml.cs +++ b/modules/account/src/Volo.Abp.Account.Web/Pages/Account/ResetPassword.cshtml.cs @@ -58,8 +58,6 @@ namespace Volo.Abp.Account.Web.Pages.Account public virtual Task OnGetAsync() { - //TODO: It would be good to try to switch tenant if needed - CheckCurrentTenant(TenantId); return Task.FromResult(Page()); } @@ -69,14 +67,17 @@ namespace Volo.Abp.Account.Web.Pages.Account try { - await AccountAppService.ResetPasswordAsync( - new ResetPasswordDto - { - UserId = UserId, - ResetToken = ResetToken, - Password = Password - } - ); + using (CurrentTenant.Change(TenantId)) + { + await AccountAppService.ResetPasswordAsync( + new ResetPasswordDto + { + UserId = UserId, + ResetToken = ResetToken, + Password = Password + } + ); + } } catch (AbpIdentityResultException e) { @@ -101,7 +102,8 @@ namespace Volo.Abp.Account.Web.Pages.Account { if (!Equals(Password, ConfirmPassword)) { - ModelState.AddModelError("ConfirmPassword", L["'{0}' and '{1}' do not match.", "ConfirmPassword", "Password"]); + ModelState.AddModelError("ConfirmPassword", + L["'{0}' and '{1}' do not match.", "ConfirmPassword", "Password"]); } base.ValidateModel();