diff options
author | Andrew Arnott <andrewarnott@gmail.com> | 2010-08-11 08:06:01 -0700 |
---|---|---|
committer | Andrew Arnott <andrewarnott@gmail.com> | 2010-08-11 08:06:01 -0700 |
commit | a2e6c27a459f85c9069c6a70add69454063a3697 (patch) | |
tree | 650ed9616399f0a63ffb21b0c24d1b99c4f51eb1 /samples/OAuthAuthorizationServer/Controllers | |
parent | 6ca475e013c985da63de553a7b630442d39fc4e5 (diff) | |
download | DotNetOpenAuth-a2e6c27a459f85c9069c6a70add69454063a3697.zip DotNetOpenAuth-a2e6c27a459f85c9069c6a70add69454063a3697.tar.gz DotNetOpenAuth-a2e6c27a459f85c9069c6a70add69454063a3697.tar.bz2 |
Fixed bug where sample logon page would throw due to no returnUrl parameter.
Diffstat (limited to 'samples/OAuthAuthorizationServer/Controllers')
-rw-r--r-- | samples/OAuthAuthorizationServer/Controllers/AccountController.cs | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/samples/OAuthAuthorizationServer/Controllers/AccountController.cs b/samples/OAuthAuthorizationServer/Controllers/AccountController.cs index 73d5999..963c7f4 100644 --- a/samples/OAuthAuthorizationServer/Controllers/AccountController.cs +++ b/samples/OAuthAuthorizationServer/Controllers/AccountController.cs @@ -1,14 +1,14 @@ -namespace OAuthAuthorizationServer.Controllers {
- using System;
- using System.Web.Mvc;
- using System.Web.Security;
-
- using DotNetOpenAuth.Messaging;
- using DotNetOpenAuth.OpenId;
- using DotNetOpenAuth.OpenId.RelyingParty;
-
- using OAuthAuthorizationServer.Models;
-
+namespace OAuthAuthorizationServer.Controllers { + using System; + using System.Web.Mvc; + using System.Web.Security; + + using DotNetOpenAuth.Messaging; + using DotNetOpenAuth.OpenId; + using DotNetOpenAuth.OpenId.RelyingParty; + + using OAuthAuthorizationServer.Models; + [HandleError] public class AccountController : Controller { // ************************************** @@ -24,7 +24,10 @@ var rp = new OpenIdRelyingParty(); var request = rp.CreateRequest(model.UserSuppliedIdentifier, Realm.AutoDetect, new Uri(Request.Url, Url.Action("Authenticate"))); if (request != null) { - request.AddCallbackArguments("returnUrl", returnUrl); + if (returnUrl != null) { + request.AddCallbackArguments("returnUrl", returnUrl); + } + return request.RedirectingResponse.AsActionResult(); } else { ModelState.AddModelError(string.Empty, "The identifier you supplied is not recognized as a valid OpenID Identifier."); @@ -42,8 +45,8 @@ switch (response.Status) { case AuthenticationStatus.Authenticated: FormsAuthentication.SetAuthCookie(response.ClaimedIdentifier, false); - return this.Redirect(returnUrl); - default:
+ return this.Redirect(returnUrl ?? Url.Action("Index", "Home")); + default: ModelState.AddModelError(string.Empty, "An error occurred during login."); break; } |