CryoKey has uploaded a new change for review. https://gerrit.wikimedia.org/r/70334
Change subject: Updated the login flow to attempt to flush credentials ...................................................................... Updated the login flow to attempt to flush credentials Users may want to change the logged-in user. However, most browsers cache SSL credentials, so users will not get a chance to change their identities. Therefore, we now attempt to flush credentials each time. The flush should work with Chrome, at the very least. Change-Id: I8ec36d3f79c75adeb78e754a1144b0e5419bd5c9 --- M README M cryokey.js M cryokey.php 3 files changed, 42 insertions(+), 6 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CryoKey refs/changes/34/70334/1 diff --git a/README b/README index 4935ac2..4686d97 100644 --- a/README +++ b/README @@ -33,7 +33,7 @@ https://www.cryokey.com On Facebook: - http://www.facebook.com/pages/CryoKey/473618025991948 + http://www.facebook.com/pages/CryoKey On Twitter: https://twitter.com/CryoKey diff --git a/cryokey.js b/cryokey.js index e364c87..92e0fb9 100644 --- a/cryokey.js +++ b/cryokey.js @@ -7,7 +7,7 @@ var CK_HEAD = document.getElementsByTagName('head')[0]; var CK_HANDLER = document.createElement('script'); var CK_URL = document.URL; -var CK_ATTEMPTS = 3; +var CK_ATTEMPTS = 0; // Insert the initially empty script block. CK_HEAD.appendChild(CK_HANDLER); @@ -21,10 +21,46 @@ throw new Error("Could not create HTTP request object."); } + +// Attempt to clear cached authentication information. +function ck_logout(_url) +{ + if (/MSIE ([0-9]{1,}[\.0-9]{0,})/.test(navigator.userAgent)) + document.execCommand('ClearAuthenticationCache'); + if (window.crypto && window.crypto.logout) + window.crypto.logout(); + window.location = _url; +} + +// Initiate a log in attempt. Clear existing credentials before the +// attempt. +function ck_initiate(_url, _ip, _pass, _start, _abort, _fail) +{ + if (/(iPad|iPhone|iPod)/.test(navigator.userAgent)) + { + CK_ATTEMPTS = 1; + ck_ticket(_url, _ip, _pass); + } + else + { + var flush = ck_get_connector(); + flush.onreadystatechange = function() + { + if (flush.readyState == 4) + { + CK_ATTEMPTS = 3; + ck_ticket(_url, _ip, _pass, _start, _abort, _fail); + } + }; + flush.open("GET", "https://www.cryokey.com/public/flush", true); + flush.send(); + } +} + // Acquire a ticket from CryoKey's ticketing module. function ck_ticket(_url, _ip, _pass, _start, _abort, _fail) { - var ticketer = "https://www.cryokey.com/private/ticket.php?url=" + escape(_url) + "&ip=" + escape(_ip); + var ticketer = "https://www.cryokey.com/private/ticket.php?mode=js&url=" + escape(_url) + "&ip=" + escape(_ip); var status = document.getElementById("ck_message"); status.innerHTML = _start; diff --git a/cryokey.php b/cryokey.php index d9d2da4..921edb8 100644 --- a/cryokey.php +++ b/cryokey.php @@ -9,7 +9,7 @@ 'path' => __FILE__, 'name' => 'CryoKey', 'descriptionmsg' => 'cryokey-desc', - 'version' => '2.0', + 'version' => '2.1', 'author' => 'Authenticade LLC', 'url' => 'https://www.mediawiki.org/wiki/Extension:CryoKey' ); @@ -102,7 +102,7 @@ // Since these values (IP, service, and pass URL) come from the // server or API, we're assuming that they are valid and don't need // scrubbing. - $action = "javascript:ck_ticket('{$service}', '{$ip}', '{$pass}', '{$msg_start}', '{$msg_abort}', '{$msg_fail}');"; + $action = "javascript:ck_initiate('{$service}', '{$ip}', '{$pass}', '{$msg_start}', '{$msg_abort}', '{$msg_fail}');"; $message = "<span id='ck_message'>" . wfMessage('cryokey-label') . "</span>"; $extras = @$_template->data['extrafields']; $extras .= "<script type='text/javascript' src='{$script}'></script>"; @@ -152,7 +152,7 @@ */ function wgck_redeem($_tid, $_service) { - return file_get_contents("https://www.cryokey.com/public/redeem.php?tid=" . urlencode($_tid) . "&from=" . urlencode($_SERVER['REMOTE_ADDR']) . "&to=" . urlencode($_service)); + return file_get_contents("https://www.cryokey.com/public/redeem.php?mode=name&tid=" . urlencode($_tid) . "&from=" . urlencode($_SERVER['REMOTE_ADDR']) . "&to=" . urlencode($_service)); } $wgHooks['UserLoginForm'][] = 'wgck_form'; -- To view, visit https://gerrit.wikimedia.org/r/70334 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I8ec36d3f79c75adeb78e754a1144b0e5419bd5c9 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/CryoKey Gerrit-Branch: master Gerrit-Owner: CryoKey <[email protected]> _______________________________________________ MediaWiki-commits mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
