我在我的帐户控制器中获取正确的UserManager实例时遇到了问题.目前,我无法重置密码以作为我的提供商工作,其他设置被忽略.
在Startup - void ConfigureAuth(IAppBuilder app)中我有以下内容:
app.CreatePerOwinContext<ViewingBookerDatabaseContext>(ViewingBookerDatabaseContext.Create);
app.CreatePerOwinContext<ApplicationUserManager>(ApplicationUserManager.Create);
Run Code Online (Sandbox Code Playgroud)
然后在AccountManager类中,上面引用的方法Create包含以下内容:
public class ApplicationUserManager : UserManager<ApplicationUser>
{
// Configure the application user manager
public ApplicationUserManager(ApplicationUserStore store)
: base(store)
{
}
public static ApplicationUserManager Create(IdentityFactoryOptions<ApplicationUserManager> options, IOwinContext context)
{
var manager = new ApplicationUserManager(new ApplicationUserStore(new ViewingBookerDatabaseContext()));
// Configure validation logic for usernames
manager.UserValidator = new UserValidator<ApplicationUser>(manager)
{
AllowOnlyAlphanumericUserNames = false,
RequireUniqueEmail = true
};
// Configure validation logic for passwords
manager.PasswordValidator = new PasswordValidator
{
RequiredLength = 6,
RequireNonLetterOrDigit = false,
RequireDigit = …Run Code Online (Sandbox Code Playgroud)