Ends in:
7 DAYS
20 HRS
31 MIN
58 SEC
Ends in:
7 D
20 H
31 M
58 S
Open Closed

Reset password without providing old password #5908


User avatar
0
lalitChougule created
  • ABP Framework version: v7.2.2
  • UI Type: Angular
  • Database System: EF Core PostgreSQL
  • Tiered (for MVC) or Auth Server Separated (for Angular): no/yes
  • Exception message and full stack trace: N.A
  • Steps to reproduce the issue:

I have a requirement where I have create few users using SQL scripts. For these users I need to share URL via email to reset password.

I found this method as per my use case in AccountAppService

public virtual async Task ResetPasswordAsync(ResetPasswordDto input)
{
    await IdentityOptions.SetAsync();

    var user = await UserManager.GetByIdAsync(input.UserId);
    (await UserManager.ResetPasswordAsync(user, input.ResetToken, input.Password)).CheckErrors();

    await IdentitySecurityLogManager.SaveAsync(new IdentitySecurityLogContext
    {
        Identity = IdentitySecurityLogIdentityConsts.Identity,
        Action = IdentitySecurityLogActionConsts.ChangePassword
    });
}

I need to know what do I pass into ResetToken ? And how to generate this Reset Token ?


1 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    var resetToken = await UserManager.GeneratePasswordResetTokenAsync(user);
    
Made with ❤️ on ABP v9.1.0-preview. Updated on November 20, 2024, 13:06