summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Arnott <andrewarnott@gmail.com>2009-10-18 21:42:30 -0700
committerAndrew Arnott <andrewarnott@gmail.com>2009-10-18 21:42:30 -0700
commit3dd3bf46f212e3bef1541465a01cbe1a1c646598 (patch)
tree9c5709404e0beec9d9c3774b0eaf36457471a761
parentd45e6b85b3b85d8043b117f85daef57213031184 (diff)
downloadDotNetOpenAuth-3dd3bf46f212e3bef1541465a01cbe1a1c646598.zip
DotNetOpenAuth-3dd3bf46f212e3bef1541465a01cbe1a1c646598.tar.gz
DotNetOpenAuth-3dd3bf46f212e3bef1541465a01cbe1a1c646598.tar.bz2
Fixed up OpenID OP button to behave (almost) like the others in terms of clicking on it causing the final "login" for the user to happen.
-rw-r--r--projecttemplates/WebFormsRelyingParty/scripts/LoginPopup.js21
-rw-r--r--src/DotNetOpenAuth/OpenId/RelyingParty/OpenIdAjaxTextBox.js7
2 files changed, 25 insertions, 3 deletions
diff --git a/projecttemplates/WebFormsRelyingParty/scripts/LoginPopup.js b/projecttemplates/WebFormsRelyingParty/scripts/LoginPopup.js
index 38b7d77..8e6019a 100644
--- a/projecttemplates/WebFormsRelyingParty/scripts/LoginPopup.js
+++ b/projecttemplates/WebFormsRelyingParty/scripts/LoginPopup.js
@@ -24,13 +24,25 @@
}
}
- function showLoginSuccess(userSuppliedIdentifier) {
+ function showLoginSuccess(userSuppliedIdentifier, hide) {
var li = document.getElementById(userSuppliedIdentifier);
if (li) {
- $(li).addClass('loginSuccess');
+ 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: '/' });
@@ -86,7 +98,10 @@
// 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')) {
- doLogin($(this)[0].id);
+ // Don't immediately login if the user clicked OpenID and he can't see the identifier box.
+ if ($(this)[0] != $('#OpenIDButton')[0] || $('#OpenIDForm').is(':visible')) {
+ doLogin($(this)[0].id);
+ }
} else if ($(this)[0] != $('#OpenIDButton')[0]) {
// Be sure to hide the openid_identifier text box unless the OpenID button is selected.
checkidSetup($(this)[0].id);
diff --git a/src/DotNetOpenAuth/OpenId/RelyingParty/OpenIdAjaxTextBox.js b/src/DotNetOpenAuth/OpenId/RelyingParty/OpenIdAjaxTextBox.js
index b087f4c..37ad88e 100644
--- a/src/DotNetOpenAuth/OpenId/RelyingParty/OpenIdAjaxTextBox.js
+++ b/src/DotNetOpenAuth/OpenId/RelyingParty/OpenIdAjaxTextBox.js
@@ -220,6 +220,10 @@ function initAjaxOpenId(box, openid_logo_url, dotnetopenid_logo_url, spinner_url
box.dnoi_internal.claimedIdentifier = null;
trace('unrecognized state ' + state);
}
+
+ if (box.onStateChanged) {
+ box.onStateChanged(state);
+ }
};
box.dnoi_internal.isBusy = function() {
@@ -585,4 +589,7 @@ function initAjaxOpenId(box, openid_logo_url, dotnetopenid_logo_url, spinner_url
box.login = function(onSuccess, onFailure) {
box.dnoi_internal.performDiscovery(box.value, onSuccess, onFailure);
};
+
+ // public events
+ // box.onStateChanged(state)
}