VerifyTwoFactorCode( VerifyTwoFactorCodeViewModel model, ModelMethodContext context) { if (!context.ModelState.IsValid) { return; } var result = TwoFactorSignIn( model.Provider, model.Code, isPersistent: false, rememberBrowser: model.RememberBrowser); switch (result) { case SignInStatus.Success: RedirectToLocal(); return; case SignInStatus.LockedOut: StateController.Navigate("AccountLocked"); return; default: context.ModelState.AddModelError("Code", "Invalid Code"); break; } }
GetVerifyTwoFactorCode() { var model = new VerifyTwoFactorCodeViewModel { Provider = StateContext.Data[ProviderNameKey] as string }; var code = StateContext.Data[CodeKey] as string; if (code != null) { model.IsDemo = true; model.DemoCode = code; } return(model); }