summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--projecttemplates/MvcRelyingParty/Controllers/AccountController.cs8
-rw-r--r--projecttemplates/MvcRelyingParty/MvcRelyingParty.csproj4
-rw-r--r--projecttemplates/MvcRelyingParty/Scripts/LoginLink.js2
-rw-r--r--projecttemplates/MvcRelyingParty/Views/Account/LogOn.aspx131
-rw-r--r--projecttemplates/MvcRelyingParty/Views/Account/LogOnContent.ascx33
-rw-r--r--projecttemplates/MvcRelyingParty/Views/Account/LogOnPopup.aspx25
-rw-r--r--projecttemplates/MvcRelyingParty/Views/Account/LogOnScripts.ascx73
7 files changed, 152 insertions, 124 deletions
diff --git a/projecttemplates/MvcRelyingParty/Controllers/AccountController.cs b/projecttemplates/MvcRelyingParty/Controllers/AccountController.cs
index 33217e9..2fd3ea1 100644
--- a/projecttemplates/MvcRelyingParty/Controllers/AccountController.cs
+++ b/projecttemplates/MvcRelyingParty/Controllers/AccountController.cs
@@ -70,6 +70,14 @@
}
/// <summary>
+ /// Prepares a web page to help the user supply his login information.
+ /// </summary>
+ /// <returns>The action result.</returns>
+ public ActionResult LogOnPopUp() {
+ return View();
+ }
+
+ /// <summary>
/// Handles the positive assertion that comes from Providers to Javascript running in the browser.
/// </summary>
/// <returns>The action result.</returns>
diff --git a/projecttemplates/MvcRelyingParty/MvcRelyingParty.csproj b/projecttemplates/MvcRelyingParty/MvcRelyingParty.csproj
index e911146..6e51a58 100644
--- a/projecttemplates/MvcRelyingParty/MvcRelyingParty.csproj
+++ b/projecttemplates/MvcRelyingParty/MvcRelyingParty.csproj
@@ -137,6 +137,8 @@
<Content Include="Scripts\jquery.cookie.js" />
<Content Include="Scripts\LoginLink.js" />
<Content Include="Setup.aspx" />
+ <Content Include="Views\Account\LogOn.aspx" />
+ <Content Include="Views\Account\LogOnContent.ascx" />
<Content Include="Views\Account\EditFields.ascx" />
<Content Include="Views\Account\Edit.aspx" />
<Content Include="Views\Home\PrivacyPolicy.aspx" />
@@ -150,7 +152,7 @@
<Content Include="Scripts\MicrosoftAjax.debug.js" />
<Content Include="Scripts\MicrosoftMvcAjax.js" />
<Content Include="Scripts\MicrosoftMvcAjax.debug.js" />
- <Content Include="Views\Account\LogOn.aspx" />
+ <Content Include="Views\Account\LogOnPopup.aspx" />
<Content Include="Views\Home\About.aspx" />
<Content Include="Views\Home\Index.aspx" />
<Content Include="Views\Shared\Error.aspx" />
diff --git a/projecttemplates/MvcRelyingParty/Scripts/LoginLink.js b/projecttemplates/MvcRelyingParty/Scripts/LoginLink.js
index d75de95..68124b0 100644
--- a/projecttemplates/MvcRelyingParty/Scripts/LoginLink.js
+++ b/projecttemplates/MvcRelyingParty/Scripts/LoginLink.js
@@ -1,5 +1,5 @@
$(function() {
- var loginContent = '/Account/LogOn';
+ var loginContent = '/Account/LogOnPopup';
var popupWindowName = 'openidlogin';
var popupWidth = 355;
var popupHeight = 205; // use 205 for 1 row of OP buttons, or 273 for 2 rows
diff --git a/projecttemplates/MvcRelyingParty/Views/Account/LogOn.aspx b/projecttemplates/MvcRelyingParty/Views/Account/LogOn.aspx
index c802af7..4709507 100644
--- a/projecttemplates/MvcRelyingParty/Views/Account/LogOn.aspx
+++ b/projecttemplates/MvcRelyingParty/Views/Account/LogOn.aspx
@@ -1,125 +1,12 @@
-<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage" %>
+<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %>
-
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
- <title>Login</title>
+<asp:Content ContentPlaceHolderID="Head" runat="server">
<link rel="Stylesheet" type="text/css" href="<%=Page.ClientScript.GetWebResourceUrl(typeof(DotNetOpenAuth.OpenId.RelyingParty.OpenIdSelector), "DotNetOpenAuth.OpenId.RelyingParty.OpenIdSelector.css")%>" />
<link rel="Stylesheet" type="text/css" href="<%=Page.ClientScript.GetWebResourceUrl(typeof(DotNetOpenAuth.OpenId.RelyingParty.OpenIdSelector), "DotNetOpenAuth.OpenId.RelyingParty.OpenIdAjaxTextBox.css")%>" />
- <link rel="stylesheet" type="text/css" href='<%= Url.Content("~/Content/loginpopup.css") %>' />
-</head>
-<body>
- <p>Login using an account you already use. </p>
- <%= Html.ValidationSummary("Login was unsuccessful. Please correct the errors and try again.") %>
-
- <% using (Html.BeginForm("LogOnPostAssertion", "Account", FormMethod.Post, new { target = "_top" })) { %>
- <%= Html.AntiForgeryToken() %>
- <%= Html.Hidden("ReturnUrl", Request.QueryString["ReturnUrl"], new { id = "ReturnUrl" }) %>
- <%= Html.Hidden("openid_openidAuthData") %>
- <div>
- <ul class="OpenIdProviders">
- <li id="https://www.google.com/accounts/o8/id" class="OPButton"><a href="#"><div><div>
- <img src="../../Content/images/google.gif" />
- <img src="<%= Page.ClientScript.GetWebResourceUrl(typeof(DotNetOpenAuth.OpenId.RelyingParty.OpenIdSelector), "DotNetOpenAuth.OpenId.RelyingParty.login_success.png") %>" class="loginSuccess" title="Authenticated as {0}" />
- </div><div class="ui-widget-overlay"></div></div></a>
- </li>
- <li id="https://me.yahoo.com/" class="OPButton"><a href="#"><div><div>
- <img src="../../Content/images/yahoo.gif" />
- <img src="<%= Page.ClientScript.GetWebResourceUrl(typeof(DotNetOpenAuth.OpenId.RelyingParty.OpenIdSelector), "DotNetOpenAuth.OpenId.RelyingParty.login_success.png") %>" class="loginSuccess" title="Authenticated as {0}" />
- </div><div class="ui-widget-overlay"></div></div></a>
- </li>
- <li id="OpenIDButton" class="OpenIDButton"><a href="#"><div><div>
- <img src="../../Content/images/openid.gif" />
- <img src="<%= Page.ClientScript.GetWebResourceUrl(typeof(DotNetOpenAuth.OpenId.RelyingParty.OpenIdSelector), "DotNetOpenAuth.OpenId.RelyingParty.login_success.png") %>" class="loginSuccess" title="Authenticated as {0}" />
- </div><div class="ui-widget-overlay"></div></div></a>
- </li>
- </ul>
- <div style="display: none" id="OpenIDForm">
- <span class="OpenIdAjaxTextBox" style="display: inline-block; position: relative; font-size: 16px">
- <input name="openid_identifier" id="openid_identifier" size="40" style="padding-left: 18px; border-style: solid; border-width: 1px; border-color: lightgray" />
- </span>
- </div>
- </div>
- <% } %>
- <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>
- <script type="text/javascript" src='<%= Url.Content("~/Scripts/MicrosoftAjax.js") %>'></script>
- <script type="text/javascript" src='<%= Url.Content("~/Scripts/MicrosoftMvcAjax.js") %>'></script>
- <% if (Request.Url.IsLoopback) { %>
- <script type="text/javascript" src='<%= Url.Content("~/Scripts/jquery-1.3.2.min.js") %>'></script>
- <script type="text/javascript" src='<%= Url.Content("~/Scripts/jquery-ui-personalized-1.6rc6.min.js") %>'></script>
- <% } else { %>
- <script type="text/javascript" language="javascript" src="http://www.google.com/jsapi"></script>
- <script type="text/javascript" language="javascript">
- google.load("jquery", "1.3.2");
- google.load("jqueryui", "1.7.2");
- </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) {
- var req = new Sys.Net.WebRequest();
- 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);
- $('#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>
-</body>
-</html>
+</asp:Content>
+<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
+ <% Html.RenderPartial("LogOnContent"); %>
+</asp:Content>
+<asp:Content ContentPlaceHolderID="ScriptsArea" runat="server">
+ <% Html.RenderPartial("LogOnScripts"); %>
+</asp:Content> \ No newline at end of file
diff --git a/projecttemplates/MvcRelyingParty/Views/Account/LogOnContent.ascx b/projecttemplates/MvcRelyingParty/Views/Account/LogOnContent.ascx
new file mode 100644
index 0000000..73f80b1
--- /dev/null
+++ b/projecttemplates/MvcRelyingParty/Views/Account/LogOnContent.ascx
@@ -0,0 +1,33 @@
+<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %>
+<p>Login using an account you already use. </p>
+<%= Html.ValidationSummary("Login was unsuccessful. Please correct the errors and try again.") %>
+
+<% using (Html.BeginForm("LogOnPostAssertion", "Account", FormMethod.Post, new { target = "_top" })) { %>
+<%= Html.AntiForgeryToken() %>
+<%= Html.Hidden("ReturnUrl", Request.QueryString["ReturnUrl"], new { id = "ReturnUrl" }) %>
+<%= Html.Hidden("openid_openidAuthData") %>
+<div>
+ <ul class="OpenIdProviders">
+ <li id="https://www.google.com/accounts/o8/id" class="OPButton"><a href="#"><div><div>
+ <img src="../../Content/images/google.gif" />
+ <img src="<%= Page.ClientScript.GetWebResourceUrl(typeof(DotNetOpenAuth.OpenId.RelyingParty.OpenIdSelector), "DotNetOpenAuth.OpenId.RelyingParty.login_success.png") %>" class="loginSuccess" title="Authenticated as {0}" />
+ </div><div class="ui-widget-overlay"></div></div></a>
+ </li>
+ <li id="https://me.yahoo.com/" class="OPButton"><a href="#"><div><div>
+ <img src="../../Content/images/yahoo.gif" />
+ <img src="<%= Page.ClientScript.GetWebResourceUrl(typeof(DotNetOpenAuth.OpenId.RelyingParty.OpenIdSelector), "DotNetOpenAuth.OpenId.RelyingParty.login_success.png") %>" class="loginSuccess" title="Authenticated as {0}" />
+ </div><div class="ui-widget-overlay"></div></div></a>
+ </li>
+ <li id="OpenIDButton" class="OpenIDButton"><a href="#"><div><div>
+ <img src="../../Content/images/openid.gif" />
+ <img src="<%= Page.ClientScript.GetWebResourceUrl(typeof(DotNetOpenAuth.OpenId.RelyingParty.OpenIdSelector), "DotNetOpenAuth.OpenId.RelyingParty.login_success.png") %>" class="loginSuccess" title="Authenticated as {0}" />
+ </div><div class="ui-widget-overlay"></div></div></a>
+ </li>
+ </ul>
+ <div style="display: none" id="OpenIDForm">
+ <span class="OpenIdAjaxTextBox" style="display: inline-block; position: relative; font-size: 16px">
+ <input name="openid_identifier" id="openid_identifier" size="40" style="padding-left: 18px; border-style: solid; border-width: 1px; border-color: lightgray" />
+ </span>
+ </div>
+</div>
+<% } %>
diff --git a/projecttemplates/MvcRelyingParty/Views/Account/LogOnPopup.aspx b/projecttemplates/MvcRelyingParty/Views/Account/LogOnPopup.aspx
new file mode 100644
index 0000000..0aebf94
--- /dev/null
+++ b/projecttemplates/MvcRelyingParty/Views/Account/LogOnPopup.aspx
@@ -0,0 +1,25 @@
+<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage" %>
+
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+ <title>Login</title>
+ <link rel="Stylesheet" type="text/css" href="<%=Page.ClientScript.GetWebResourceUrl(typeof(DotNetOpenAuth.OpenId.RelyingParty.OpenIdSelector), "DotNetOpenAuth.OpenId.RelyingParty.OpenIdSelector.css")%>" />
+ <link rel="Stylesheet" type="text/css" href="<%=Page.ClientScript.GetWebResourceUrl(typeof(DotNetOpenAuth.OpenId.RelyingParty.OpenIdSelector), "DotNetOpenAuth.OpenId.RelyingParty.OpenIdAjaxTextBox.css")%>" />
+ <link rel="stylesheet" type="text/css" href='<%= Url.Content("~/Content/loginpopup.css") %>' />
+</head>
+<body>
+<% Html.RenderPartial("LogOnContent"); %>
+ <% if (Request.Url.IsLoopback) { %>
+ <script type="text/javascript" src='<%= Url.Content("~/Scripts/jquery-1.3.2.min.js") %>'></script>
+ <script type="text/javascript" src='<%= Url.Content("~/Scripts/jquery-ui-personalized-1.6rc6.min.js") %>'></script>
+ <% } else { %>
+ <script type="text/javascript" language="javascript" src="http://www.google.com/jsapi"></script>
+ <script type="text/javascript" language="javascript">
+ google.load("jquery", "1.3.2");
+ google.load("jqueryui", "1.7.2");
+ </script>
+ <% } %>
+<% Html.RenderPartial("LogOnScripts"); %>
+</body>
+</html>
diff --git a/projecttemplates/MvcRelyingParty/Views/Account/LogOnScripts.ascx b/projecttemplates/MvcRelyingParty/Views/Account/LogOnScripts.ascx
new file mode 100644
index 0000000..8f0f52b
--- /dev/null
+++ b/projecttemplates/MvcRelyingParty/Views/Account/LogOnScripts.ascx
@@ -0,0 +1,73 @@
+<%@ 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>
+<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) {
+ var req = new Sys.Net.WebRequest();
+ 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>