Open Closed

IdentityOptions and UserManager in 4.4.2? #1089


User avatar
0
hansmogren created

Hi! After upgrading to 4.2.2 from 3.3.1 our "change password" function that we call from our custom built front-end does not work anymore. I suspect it has to do with the changes described in the migration guide here: https://docs.abp.io/en/abp/latest/Migration-Guides/Abp-4_0#identityoptions-usage since it seems like the password related settings we've set in ABP settings are not being used.

We are simply calling

var result = await _userManager.ChangePasswordAsync(user, currentPassword, newPassword);

and the userManager injected is Microsoft.AspNetCore.Identity.UserManager<Volo.Abp.Identity.IdentityUser>.

Now, we've got it to work by injecting IOptions<IdentityOptions> and calling the SetAsync method as described:

await _options.SetAsync();
var result = await _userManager.ChangePasswordAsync(user, currentPassword, newPassword);

Is this correct usage or is there a better way?

  • ABP Framework version: v4.2.2
  • UI type: MVC
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): no
  • Exception message and stack trace:
  • Steps to reproduce the issue:

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

    hi

    You are right, calling the SetAsync method is the right way.

  • User Avatar
    0
    hansmogren created

    You are right, calling the SetAsync method is the right way.

    Thank you!

Made with ❤️ on ABP v9.1.0-preview. Updated on November 18, 2024, 05:54