brockallen / BrockAllen.MembershipReboot

MembershipReboot is a user identity management and authentication library.
Other
742 stars 238 forks source link

account.PasswordResetSecrets.Any() is null when calling password reset #601

Open Robban1980 opened 8 years ago

Robban1980 commented 8 years ago

I am working on a flow where and administrator will create users by calling an API. The Administrator will not know the password and the users will have to set it through a password reset.

So when i call the API to create the user it works great, auto verifying the account with .SetConfirmedEmail method so that a password reset mail can be sent. In the same flow i call ResetPassword(email) when doing this in this flow right after the account was created i get a Null reference exception.

I found that there is a check in the ResetPassword(string tenant, string email) method in the UserAccountService.cs on line 1446 looking like this if (account.PasswordResetSecrets.Any()). In this flow i have built now the account.PasswordResetSecrets is always null causing the null reference exception.

If i instead redo the ResetPassword part manually then it works fine. Any idea on why it is null right after account creation but not the second time around?

brockallen commented 8 years ago

Not sure, but if you want write a unit test to reproduce it then we can get it fixed. Also, it might be just easier to send a PR that checks that for null.

Robban1980 commented 8 years ago

Will try to fix it an do a PR.