Browse Source

Add TenantId to ResetPasswordDto

pull/9277/head
liangshiwei 5 years ago
parent
commit
f843a679b2
  1. 2
      modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/ResetPasswordDto.cs
  2. 19
      modules/account/src/Volo.Abp.Account.Application/Volo/Abp/Account/AccountAppService.cs
  3. 20
      modules/account/src/Volo.Abp.Account.Web/Pages/Account/ResetPassword.cshtml.cs

2
modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/ResetPasswordDto.cs

@ -8,6 +8,8 @@ namespace Volo.Abp.Account
{ {
public Guid UserId { get; set; } public Guid UserId { get; set; }
public Guid? TenantId { get; set; }
[Required] [Required]
public string ResetToken { get; set; } public string ResetToken { get; set; }

19
modules/account/src/Volo.Abp.Account.Application/Volo/Abp/Account/AccountAppService.cs

@ -62,16 +62,19 @@ namespace Volo.Abp.Account
public virtual async Task ResetPasswordAsync(ResetPasswordDto input) public virtual async Task ResetPasswordAsync(ResetPasswordDto input)
{ {
await IdentityOptions.SetAsync(); using (CurrentTenant.Change(input.TenantId))
{
await IdentityOptions.SetAsync();
var user = await UserManager.GetByIdAsync(input.UserId); var user = await UserManager.GetByIdAsync(input.UserId);
(await UserManager.ResetPasswordAsync(user, input.ResetToken, input.Password)).CheckErrors(); (await UserManager.ResetPasswordAsync(user, input.ResetToken, input.Password)).CheckErrors();
await IdentitySecurityLogManager.SaveAsync(new IdentitySecurityLogContext await IdentitySecurityLogManager.SaveAsync(new IdentitySecurityLogContext
{ {
Identity = IdentitySecurityLogIdentityConsts.Identity, Identity = IdentitySecurityLogIdentityConsts.Identity,
Action = IdentitySecurityLogActionConsts.ChangePassword Action = IdentitySecurityLogActionConsts.ChangePassword
}); });
}
} }
protected virtual async Task<IdentityUser> GetUserByEmail(string email) protected virtual async Task<IdentityUser> GetUserByEmail(string email)

20
modules/account/src/Volo.Abp.Account.Web/Pages/Account/ResetPassword.cshtml.cs

@ -67,17 +67,15 @@ namespace Volo.Abp.Account.Web.Pages.Account
try try
{ {
using (CurrentTenant.Change(TenantId)) await AccountAppService.ResetPasswordAsync(
{ new ResetPasswordDto
await AccountAppService.ResetPasswordAsync( {
new ResetPasswordDto UserId = UserId,
{ ResetToken = ResetToken,
UserId = UserId, Password = Password,
ResetToken = ResetToken, TenantId = TenantId
Password = Password }
} );
);
}
} }
catch (AbpIdentityResultException e) catch (AbpIdentityResultException e)
{ {

Loading…
Cancel
Save