I'm trying to implement password reset functionality with nightly build of ASP.NET Identity 1.1. There is a UserManager.GetPasswordResetToken method, but it throws an exception "No ITokenProvider is registered". Is there an built in token provider in ASP.NET Identity? If yes, how I can register it? If no, how I can implement one? Will be default Token Provider in the 1.1. release? And final question, is there an estimated 1.1 release date?
相关问题
- Sorting 3 numbers without branching [closed]
- Graphics.DrawImage() - Throws out of memory except
- Carriage Return (ASCII chr 13) is missing from tex
- Why am I getting UnauthorizedAccessException on th
- 求获取指定qq 资料的方法
If someone looking for solution under AspNet.Identity 2.0 beta1 version.
Only this need to be modified.
PasswordResetTokens
andUserConfirmationTokens
is merged intoUserTokenProvider
property and token provider class is also modified.The default token provider implementation is found in the
Microsoft.Identity.Owin
package:And you do something like this to wire one up using the default data protection provider from your OWIN
IAppBuilder
Ok, answering my own question based on @hao-kung reply. First add static constructor and UserManagerFactory to Statrup class (startup.auth.cs)
Then init UserManager in the AccountController using that UserManagerFactory
Another way to do this (building on the other answers but simplifying it some) is to change
Startup.Auth.cs
so it looks similar to this:Then, modify the default constructor in
AccountController.cs
so that it looks similar to this: