public ActionResult LogOn(LogOnInputModel model, string returnUrl) { if (ModelState.IsValid) { if (_authentication.LogonUser(model.UserName, model.Password, model.RememberMe)) { if (Url.IsLocalUrl(returnUrl) && returnUrl.Length > 1 && returnUrl.StartsWith("/") && !returnUrl.StartsWith("//") && !returnUrl.StartsWith("/\\")) { return(Redirect(returnUrl)); } else { return(RedirectToAction("Index", "Home")); } } else { ModelState.AddModelError("", "The user name or password provided is incorrect."); } } // If we got this far, something failed, redisplay form return(View(model)); }
public ActionResult LogOn(LogOnInputModel model) { if (!Identifier.IsValid(model.OpenIdIdentifier)) { ModelState.AddModelError("OpenIdIdentifier", "Invalid identifier"); return(View(model)); } else { var openid = new OpenIdRelyingParty(); var request = openid.CreateRequest( Identifier.Parse(model.OpenIdIdentifier)); request.AddExtension(new ClaimsRequest { Email = DemandLevel.Request, FullName = DemandLevel.Request }); return(request.RedirectingResponse.AsActionResult()); } }