diff options
author | Andrew Arnott <andrewarnott@gmail.com> | 2010-03-08 16:29:40 -0800 |
---|---|---|
committer | Andrew Arnott <andrewarnott@gmail.com> | 2010-03-08 16:29:40 -0800 |
commit | 29d039ecca5bdbdba9ed379dcd6f0fbd54df610e (patch) | |
tree | 7a0d91801b845754d3fcf776898e9504bd68d85a /projecttemplates | |
parent | 9d677a4fa58e61a750f62e28714a6f6945a7b3b9 (diff) | |
download | DotNetOpenAuth-29d039ecca5bdbdba9ed379dcd6f0fbd54df610e.zip DotNetOpenAuth-29d039ecca5bdbdba9ed379dcd6f0fbd54df610e.tar.gz DotNetOpenAuth-29d039ecca5bdbdba9ed379dcd6f0fbd54df610e.tar.bz2 |
Moved a bunch of the <SCRIPT> tags for the MVC Selector to an HTML helper method.
Diffstat (limited to 'projecttemplates')
-rw-r--r-- | projecttemplates/MvcRelyingParty/Global.asax.cs | 3 | ||||
-rw-r--r-- | projecttemplates/MvcRelyingParty/Views/Account/LogOnScripts.ascx | 70 |
2 files changed, 5 insertions, 68 deletions
diff --git a/projecttemplates/MvcRelyingParty/Global.asax.cs b/projecttemplates/MvcRelyingParty/Global.asax.cs index 14772ae..34f7a81 100644 --- a/projecttemplates/MvcRelyingParty/Global.asax.cs +++ b/projecttemplates/MvcRelyingParty/Global.asax.cs @@ -26,6 +26,9 @@ "Default", "{controller}/{action}/{id}", new { controller = "Home", action = "Index", id = string.Empty }); + routes.MapRoute( + "OpenIdDiscover", + "Account/Discover"); } protected void Application_Start() { diff --git a/projecttemplates/MvcRelyingParty/Views/Account/LogOnScripts.ascx b/projecttemplates/MvcRelyingParty/Views/Account/LogOnScripts.ascx index 1f0e752..e983872 100644 --- a/projecttemplates/MvcRelyingParty/Views/Account/LogOnScripts.ascx +++ b/projecttemplates/MvcRelyingParty/Views/Account/LogOnScripts.ascx @@ -1,72 +1,6 @@ <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %> -<script type="text/javascript" language="javascript"><!-- - //<![CDATA[ - //window.openid_visible_iframe = true; // causes the hidden iframe to show up - //window.openid_trace = true; // causes lots of messages -//]]>--></script> +<%@ Import Namespace="DotNetOpenAuth.Mvc" %> <script type="text/javascript" src='<%= Url.Content("~/Scripts/MicrosoftAjax.js") %>'></script> <script type="text/javascript" src='<%= Url.Content("~/Scripts/MicrosoftMvcAjax.js") %>'></script> <script type="text/javascript" src='<%= Url.Content("~/Scripts/jquery.cookie.js") %>'></script> -<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/yui/2.8.0r4/build/yuiloader/yuiloader-min.js"></script> -<script type="text/javascript" src="<%=Page.ClientScript.GetWebResourceUrl(typeof(DotNetOpenAuth.OpenId.RelyingParty.OpenIdSelector), "DotNetOpenAuth.OpenId.RelyingParty.OpenIdRelyingPartyControlBase.js")%>"></script> -<script type="text/javascript" src="<%=Page.ClientScript.GetWebResourceUrl(typeof(DotNetOpenAuth.OpenId.RelyingParty.OpenIdSelector), "DotNetOpenAuth.OpenId.RelyingParty.OpenIdRelyingPartyAjaxControlBase.js")%>"></script> -<script type="text/javascript" src="<%=Page.ClientScript.GetWebResourceUrl(typeof(DotNetOpenAuth.OpenId.RelyingParty.OpenIdSelector), "DotNetOpenAuth.OpenId.RelyingParty.OpenIdAjaxTextBox.js")%>"></script> -<script type="text/javascript" language="javascript"><!-- - //<![CDATA[ - try { - if (YAHOO) { - var loader = new YAHOO.util.YUILoader({ - require: ['button', 'menu'], - loadOptional: false, - combine: true - }); - - loader.insert(); - } - } catch (e) { } - window.aspnetapppath = '/'; - window.dnoa_internal.maxPositiveAssertionLifetime = 5 * 60 * 1000; - window.dnoa_internal.callbackAsync = function (argument, resultFunction, errorCallback) { - jQuery.ajax({ - async: true, - dataType: "text", - error: function (request, status, error) { errorCallback(status, argument); }, - success: function (result) { resultFunction(result, argument); }, - url: '<%= Url.Action("Discover") %>?identifier=' + encodeURIComponent(argument) - }); - }; - window.postLoginAssertion = function (positiveAssertion) { - $('#openid_openidAuthData')[0].setAttribute('value', positiveAssertion); - if (!$('#ReturnUrl')[0].value) { // popups have no ReturnUrl predefined, but full page LogOn does. - $('#ReturnUrl')[0].setAttribute('value', window.parent.location.href); - } - document.forms[0].submit(); - }; - $(function () { - var box = document.getElementsByName('openid_identifier')[0]; - initAjaxOpenId( - box, - '<%=Page.ClientScript.GetWebResourceUrl(typeof(DotNetOpenAuth.OpenId.RelyingParty.OpenIdSelector), "DotNetOpenAuth.OpenId.RelyingParty.openid_login.gif")%>', - '<%=Page.ClientScript.GetWebResourceUrl(typeof(DotNetOpenAuth.OpenId.RelyingParty.OpenIdSelector), "DotNetOpenAuth.OpenId.RelyingParty.spinner.gif")%>', - '<%=Page.ClientScript.GetWebResourceUrl(typeof(DotNetOpenAuth.OpenId.RelyingParty.OpenIdSelector), "DotNetOpenAuth.OpenId.RelyingParty.login_success.png")%>', - '<%=Page.ClientScript.GetWebResourceUrl(typeof(DotNetOpenAuth.OpenId.RelyingParty.OpenIdSelector), "DotNetOpenAuth.OpenId.RelyingParty.login_failure.png")%>', - 3, // throttle - 8000, // timeout - null, // js function to invoke on receiving a positive assertion - "LOG IN", - "Click here to log in using a pop-up window.", - true, // ShowLogOnPostBackButton - "Click here to log in immediately.", - "RETRY", - "Retry a failed identifier discovery.", - "Discovering/authenticating", - "Please correct errors in OpenID identifier and allow login to complete before submitting.", - "Please wait for login to complete.", - "Authenticated by {0}.", - "Authenticated as {0}.", - "Authentication failed.", - false, // auto postback - null); // PostBackEventReference (unused in MVC) - }); -//]]>--></script> -<script type="text/javascript" src="<%=Page.ClientScript.GetWebResourceUrl(typeof(DotNetOpenAuth.OpenId.RelyingParty.OpenIdSelector), "DotNetOpenAuth.OpenId.RelyingParty.OpenIdSelector.js")%>"></script> +<%= Html.OpenIdSelectorScripts(this.Page, new OpenIdSelectorOptions { })%> |