[Samples]Support remember me with two factor authentication


When logging into the Identity Sample app the Remember me checkbox is ignored when two factor authentication is enabled. Attached is a diff that highlights the changes I made to get it working for me. More changes are most likely needed but this is a start.

Note that the diff is most likely only useful for reading in a text editor. (Looking forward to seeing the source code open up for forking, pull requests and such. :-)

file attachments

Closed Aug 19, 2014 at 12:14 AM by suhasj


zam6ak wrote Apr 23, 2014 at 8:13 PM

You are further along then I am. ;)I am not using two factor auth, just a simple MVC cookie auth, and I cannot get "Remeber Me?" to work.

I tried following directly in the controller (notice IsPersistent = true) and it does not work for me at...

```[HttpPost][AllowAnonymous][ValidateAntiForgeryToken]public async Task SignIn(SignInViewModel model, string returnUrl){ if (ModelState.IsValid) { var user = await _userManager.FindAsync(model.Email, model.Password); if (user != null) { _authenticationManager.SignOut(DefaultAuthenticationTypes.ExternalCookie); _authenticationManager.SignIn(new AuthenticationProperties() { IsPersistent = true }, await user.GenerateUserIdentityAsync(_userManager)); return RedirectToLocal(returnUrl); } else { ModelState.AddModelError("", "Invalid username or password."); } }
// If we got this far, something failed, redisplay form    return View(model);}```

suhasj wrote Jun 5, 2014 at 10:49 PM

Will be fixed for next release