diff options
author | Andrew Arnott <andrewarnott@gmail.com> | 2009-03-16 09:31:50 -0700 |
---|---|---|
committer | Andrew Arnott <andrewarnott@gmail.com> | 2009-03-16 09:31:50 -0700 |
commit | f9587cf9e930c6a0c6d998dbbcf2c45db822242c (patch) | |
tree | 81d92a737e22e6d6a92c345a39b90bb31cbdd280 /samples/RelyingPartyMvc/Controllers | |
parent | 145c02c4af00fbb9ac67b7acae13dcaddc75dba8 (diff) | |
download | DotNetOpenAuth-f9587cf9e930c6a0c6d998dbbcf2c45db822242c.zip DotNetOpenAuth-f9587cf9e930c6a0c6d998dbbcf2c45db822242c.tar.gz DotNetOpenAuth-f9587cf9e930c6a0c6d998dbbcf2c45db822242c.tar.bz2 |
Fixed a couple of login quirks with MVC samples.
Diffstat (limited to 'samples/RelyingPartyMvc/Controllers')
-rw-r--r-- | samples/RelyingPartyMvc/Controllers/UserController.cs | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/samples/RelyingPartyMvc/Controllers/UserController.cs b/samples/RelyingPartyMvc/Controllers/UserController.cs index bebdaa5..ba94efe 100644 --- a/samples/RelyingPartyMvc/Controllers/UserController.cs +++ b/samples/RelyingPartyMvc/Controllers/UserController.cs @@ -32,7 +32,7 @@ return View("Login"); } - public ActionResult Authenticate() { + public ActionResult Authenticate(string returnUrl) { var openid = new OpenIdRelyingParty(); var response = openid.GetResponse(); if (response == null) { @@ -40,7 +40,7 @@ Identifier id; if (Identifier.TryParse(Request.Form["openid_identifier"], out id)) { try { - openid.CreateRequest(Request.Form["openid_identifier"]).RedirectToProvider(); + return openid.CreateRequest(Request.Form["openid_identifier"]).RedirectingResponse.AsActionResult(); } catch (ProtocolException ex) { ViewData["Message"] = ex.Message; return View("Login"); @@ -54,8 +54,12 @@ switch (response.Status) { case AuthenticationStatus.Authenticated: Session["FriendlyIdentifier"] = response.FriendlyIdentifierForDisplay; - FormsAuthentication.RedirectFromLoginPage(response.ClaimedIdentifier, false); - break; + FormsAuthentication.SetAuthCookie(response.ClaimedIdentifier, false); + if (!string.IsNullOrEmpty(returnUrl)) { + return Redirect(returnUrl); + } else { + return RedirectToAction("Index", "Home"); + } case AuthenticationStatus.Canceled: ViewData["Message"] = "Canceled at provider"; return View("Login"); |