summaryrefslogtreecommitdiffstats
path: root/projecttemplates/WebFormsRelyingParty
diff options
context:
space:
mode:
authorAndrew Arnott <andrewarnott@gmail.com>2009-10-19 17:00:30 -0700
committerAndrew Arnott <andrewarnott@gmail.com>2009-10-19 17:00:30 -0700
commit84c333dec688086de9071ff711e7435a68978f26 (patch)
tree36f150fc5d86f94c68e8f194f8a534d95ec062e9 /projecttemplates/WebFormsRelyingParty
parent7309935b61d50be6ad0d685f10e52e132c843fa2 (diff)
downloadDotNetOpenAuth-84c333dec688086de9071ff711e7435a68978f26.zip
DotNetOpenAuth-84c333dec688086de9071ff711e7435a68978f26.tar.gz
DotNetOpenAuth-84c333dec688086de9071ff711e7435a68978f26.tar.bz2
Moved the loginpopup.js content to an embedded .js resource in the library.
Lots more tinkering, refactoring, and possibly tearing out the jQuery dependency still to go.
Diffstat (limited to 'projecttemplates/WebFormsRelyingParty')
-rw-r--r--projecttemplates/WebFormsRelyingParty/LoginFrame.aspx22
-rw-r--r--projecttemplates/WebFormsRelyingParty/scripts/LoginPopup.js135
2 files changed, 12 insertions, 145 deletions
diff --git a/projecttemplates/WebFormsRelyingParty/LoginFrame.aspx b/projecttemplates/WebFormsRelyingParty/LoginFrame.aspx
index 1e4dd40..9b31273 100644
--- a/projecttemplates/WebFormsRelyingParty/LoginFrame.aspx
+++ b/projecttemplates/WebFormsRelyingParty/LoginFrame.aspx
@@ -11,6 +11,17 @@
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link type="text/css" href="theme/ui.all.css" rel="Stylesheet" />
<link href="styles/loginpopup.css" rel="stylesheet" type="text/css" />
+
+ <script type="text/javascript" src="scripts/jquery-1.3.1.js"></script>
+ <script type="text/javascript" src="scripts/jquery-ui-personalized-1.6rc6.js"></script>
+ <script type="text/javascript" src="scripts/jquery.cookie.js"></script>
+ <!-- <script 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 src="scripts/LoginPopup.js" type="text/javascript"></script>
<script>
//window.openid_visible_iframe = true; // causes the hidden iframe to show up
//window.openid_trace = true; // causes lots of messages
@@ -50,16 +61,5 @@
</p>
</div>
</div>
-
- <script type="text/javascript" src="scripts/jquery-1.3.1.js"></script>
- <script type="text/javascript" src="scripts/jquery-ui-personalized-1.6rc6.js"></script>
- <script type="text/javascript" src="scripts/jquery.cookie.js"></script>
- <!-- <script 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 src="scripts/LoginPopup.js" type="text/javascript"></script>
</body>
</html>
diff --git a/projecttemplates/WebFormsRelyingParty/scripts/LoginPopup.js b/projecttemplates/WebFormsRelyingParty/scripts/LoginPopup.js
index a03f9e9..5f28270 100644
--- a/projecttemplates/WebFormsRelyingParty/scripts/LoginPopup.js
+++ b/projecttemplates/WebFormsRelyingParty/scripts/LoginPopup.js
@@ -1,134 +1 @@
-$(function() {
- var ajaxbox = $('#openid_identifier')[0];
- ajaxbox.value = $.cookie('openid_identifier') || '';
-
- if (ajaxbox.value.length > 0) {
- var ops = $('ul.OpenIdProviders li');
- ops.addClass('grayedOut');
- var matchFound = false;
- ops.each(function(i, li) {
- if (li.id == ajaxbox.value) {
- $(li)
- .removeClass('grayedOut')
- .addClass('focused');
- matchFound = true;
- }
- });
- if (!matchFound) {
- $('#OpenIDButton')
- .removeClass('grayedOut')
- .addClass('focused');
- $('#OpenIDForm').show('slow', function() {
- $('#openid_identifier').focus();
- });
- }
- }
-
- function showLoginSuccess(userSuppliedIdentifier, hide) {
- var li = document.getElementById(userSuppliedIdentifier);
- if (li) {
- if (hide) {
- $(li).removeClass('loginSuccess');
- } else {
- $(li).addClass('loginSuccess');
- }
- }
- }
-
- ajaxbox.onStateChanged = function(state) {
- if (state == "authenticated") {
- showLoginSuccess('OpenIDButton');
- } else {
- showLoginSuccess('OpenIDButton', true); // hide checkmark
- }
- };
-
- function checkidSetup(identifier, timerBased) {
- var retain = !$('#NotMyComputer')[0].selected;
- $.cookie('openid_identifier', retain ? identifier : null, { path: '/' });
- var openid = new window.OpenIdIdentifier(identifier);
- if (!openid) { throw 'checkidSetup called without an identifier.'; }
- openid.login(function(discoveryResult, respondingEndpoint, extensionResponses) {
- showLoginSuccess(discoveryResult.userSuppliedIdentifier);
- doLogin(respondingEndpoint);
- });
- }
-
- // Sends the positive assertion we've collected to the server and actually logs the user into the RP.
- function doLogin(respondingEndpoint) {
- alert('at this point, the whole page would refresh and you would be logged in as ' + respondingEndpoint.claimedIdentifier);
- //window.postLoginAssertion(respondingEndpoint.response, window.parent.location.href);
- }
-
- // This FrameManager will be used for background logins for the OP buttons
- // and the last used identifier. It is NOT the frame manager used by the
- // OpenIdAjaxTextBox, as it has its own.
- var backgroundTimeout = 3000;
-
- $(document).ready(function() {
- var ops = $('ul.OpenIdProviders li');
- ops.each(function(i, li) {
- if (li.id != 'OpenIDButton') {
- li.authenticationIFrames = new window.dnoa_internal.FrameManager(1/*throttle*/);
- var openid = new window.OpenIdIdentifier(li.id);
- openid.loginBackground(li.authenticationIFrames, function(discoveryResult, respondingEndpoint, extensionResponses) {
- showLoginSuccess(li.id);
- //alert('OP button background login as ' + respondingEndpoint.claimedIdentifier + ' was successful!');
- }, null, backgroundTimeout);
- }
- });
- });
-
- $('ul.OpenIdProviders li').click(function() {
- var lastFocus = $('.focused')[0];
- if (lastFocus != $(this)[0]) {
- $('ul.OpenIdProviders li').removeClass('focused');
- $(this).addClass('focused');
- }
-
- // Make sure we're not graying out any OPs if the user clicked on a gray button.
- if ($(this).hasClass('grayedOut')) {
- $('ul.OpenIdProviders li').removeClass('grayedOut');
- }
-
- // Be sure to hide the openid_identifier text box unless the OpenID button is selected.
- if ($(this)[0] != $('#OpenIDButton')[0] && $('#OpenIDForm').is(':visible')) {
- $('#OpenIDForm').hide('slow');
- }
-
- // If the user clicked on a button that has the "we're ready to log you in immediately",
- // then log them in!
- if ($(this).hasClass('loginSuccess')) {
- var relevantUserSuppliedIdentifier = null;
- // Don't immediately login if the user clicked OpenID and he can't see the identifier box.
- if ($(this)[0].id != 'OpenIDButton') {
- relevantUserSuppliedIdentifier = $(this)[0].id;
- } else if ($('#OpenIDForm').is(':visible')) {
- relevantUserSuppliedIdentifier = ajaxbox.value;
- }
-
- if (relevantUserSuppliedIdentifier) {
- var respondingEndpoint = window.dnoa_internal.discoveryResults[relevantUserSuppliedIdentifier].findSuccessfulRequest();
- doLogin(respondingEndpoint);
- }
- } else if ($(this)[0] != $('#OpenIDButton')[0]) {
- checkidSetup($(this)[0].id);
- }
- });
- $('#OpenIDButton').click(function() {
- if ($('#OpenIDForm').is(':hidden')) {
- $('#OpenIDForm').show('slow', function() {
- $('#openid_identifier').focus();
- });
- } else {
- $('#openid_identifier').focus();
- }
- });
-
- // Make popup window close on escape (the dialog style is already taken care of)
- $(document).keydown(function(e) {
- if (e.keyCode == $.ui.keyCode.ESCAPE) {
- window.close();
- }
- });
-}); \ No newline at end of file
+ \ No newline at end of file