C# 标识3重置密码无法登录

C# 标识3重置密码无法登录,c#,asp.net,asp.net-core,asp.net-core-mvc,asp.net-identity-3,C#,Asp.net,Asp.net Core,Asp.net Core Mvc,Asp.net Identity 3,我正在使用asp.NET5、MVC6、Identity 3和EF7以及所有更新到RC1的内容 我的启动服务配置中包含以下内容: services.AddCaching(); services.AddSession(); services.AddEntityFramework().AddInMemoryDatabase().AddDbContext<MyContext>(o => o.UseInMemoryDatabase());

我正在使用asp.NET5、MVC6、Identity 3和EF7以及所有更新到RC1的内容

我的启动服务配置中包含以下内容:

        services.AddCaching();
        services.AddSession();

     services.AddEntityFramework().AddInMemoryDatabase().AddDbContext<MyContext>(o => o.UseInMemoryDatabase());
        services.AddIdentity<User, Role>()
            .AddEntityFrameworkStores<MyContext, Guid>()
            .AddDefaultTokenProviders();


        services.AddAuthentication();
我尝试用ResetPasswordAsync重置用户密码,但由于一些奇怪的原因,我在这里遇到了一些问题

  • 首先,当我尝试重置密码时,我得到一个错误,我需要大写,即使我有大写、小写和数字

  • 第二,如果我禁用services.AddIdentity中的所有要求并重置密码,我将获得成功,但当我尝试使用新密码登录时,它不起作用

我真的不明白发生了什么,但是有没有已知的bug

身份选项

        options.User.RequireUniqueEmail = true;
        //Password
        options.Password.RequiredLength = 7;
        options.Password.RequireUppercase = false;
        options.Password.RequireLowercase = false;

        options.SignIn.RequireConfirmedEmail = false;
        options.AccessDeniedPath = new PathString("/Account/Login");
        options.LoginPath = new PathString("/Account/Login");
        options.LogoutPath = new PathString("/");
        options.AuthenticationScheme = IdentityCookieOptions.ApplicationCookieAuthenticationType = "ApplicationCookie";
        options.AutomaticChallenge = true;

我在github上重现了这个问题:

这个问题只是我代码中的一个大错误,我没有将正确的变量传递给API。这项工作:

        var token = model.Token;
        var userid = model.UserId;
        var user = await _userManager.FindByIdAsync(userid);
        var result = await _userManager.ResetPasswordAsync(user, token, model.Password);
这不起作用(出于明显的原因。提示:userid:p):


这个问题只是我代码中的一个大错误,我没有将正确的变量传递给API。这项工作:

        var token = model.Token;
        var userid = model.UserId;
        var user = await _userManager.FindByIdAsync(userid);
        var result = await _userManager.ResetPasswordAsync(user, token, model.Password);
这不起作用(出于明显的原因。提示:userid:p):

        var token = model.Token;
        var userid = model.UserId;
        var user = await _userManager.FindByIdAsync(userid);
        var result = await _userManager.ResetPasswordAsync(user, token, userid);