CryoKey has submitted this change and it was merged.

Change subject: Support CryoKey Android client
......................................................................


Support CryoKey Android client

The extension will now be able to use the CryoKey Android app to complete
authentication (if available).

Change-Id: Iadcaf300c8d23e6ac1fda591257cec5148288860
---
M cryokey.js
M cryokey.php
2 files changed, 21 insertions(+), 8 deletions(-)

Approvals:
  CryoKey: Verified; Looks good to me, approved



diff --git a/cryokey.js b/cryokey.js
index 8a329f8..78e9150 100644
--- a/cryokey.js
+++ b/cryokey.js
@@ -3,6 +3,8 @@
 // MIT License - See LICENSE file for details.
 //
 
+var CK_HOME = "https://www.cryokey.com";;
+
 // These placeholders will contain the actual ticket handlers.
 var CK_HEAD = document.getElementsByTagName('head')[0];
 var CK_HANDLER = document.createElement('script');
@@ -48,6 +50,12 @@
     ck_ticket(_url, _ip, _pass, _start, _abort, _fail);
     return;
   }
+  if (/Android/.test(navigator.userAgent))
+  {
+    // Note: the CryoKey Android application must be available.
+    window.location = CK_HOME + "/private/ticket.php?mode=plain&url=" + 
escape(_url) + "&ip=" + escape(_ip) + "&pass=" + escape(_pass);
+    return;
+  }
   if (window.crypto && window.crypto.logout)
   {
     window.crypto.logout();
@@ -65,7 +73,7 @@
        ck_ticket(_url, _ip, _pass, _start, _abort, _fail);
      }
   }
-  flush.open("GET", "https://www.cryokey.com/public/flush";, true);
+  flush.open("GET", CK_HOME + "/public/flush", true);
   flush.send();
 }
 
@@ -73,7 +81,7 @@
 function ck_ticket(_url, _ip, _pass, _start, _abort, _fail)
 {
   var now = new Date().getTime() / 1000;
-  var ticketer = "https://www.cryokey.com/private/ticket.php?mode=js&url="; + 
escape(_url) + "&ip=" + escape(_ip) + "&skew=" + now;
+  var ticketer = CK_HOME + "/private/ticket.php?mode=js&url=" + escape(_url) + 
"&ip=" + escape(_ip) + "&skew=" + now;
   var status = document.getElementById("ck_message");
 
   status.innerHTML = _start;
@@ -105,7 +113,7 @@
 function ck_login(_tid)
 {
   if (/\?/.test(CK_URL))
-    window.location = CK_URL + "&ckid=" + escape(_tid);
+    window.location = CK_URL + "&cktid=" + escape(_tid);
   else
-    window.location = CK_URL + "?ckid=" + escape(_tid);
+    window.location = CK_URL + "?cktid=" + escape(_tid);
 }
diff --git a/cryokey.php b/cryokey.php
index b90c852..e65c39f 100644
--- a/cryokey.php
+++ b/cryokey.php
@@ -9,7 +9,7 @@
   'path' => __FILE__,
   'name' => 'CryoKey',
   'descriptionmsg' => 'cryokey-desc',
-  'version' => '2.1',
+  'version' => '2.2',
   'author' => 'Authenticade LLC',
   'url' => 'https://www.mediawiki.org/wiki/Extension:CryoKey'
 );
@@ -19,6 +19,9 @@
 
 // Allow Auto-Registration behavior if "true".
 $wgCKAutoRegister = false;
+
+// Internal constant: home directory
+$CK_HOME = "https://www.cryokey.com";;
 
 /**
  * The CryoKey JavaScript should always be available to handle
@@ -43,9 +46,9 @@
   global $wgScriptPath;
 
   // Check to see if the request includes a CryoKey ticket.
-  if (isset($_GET['ckid']))
+  if (isset($_GET['cktid']))
   {
-    $email = wgck_redeem($_GET['ckid'], $wgScriptPath);
+    $email = wgck_redeem($_GET['cktid'], $wgScriptPath);
     if (!empty($email))
     {
       // Search for an existing user by E-Mail address.
@@ -175,7 +178,9 @@
  */
 function wgck_redeem($_tid, $_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));
+  global $CK_HOME;
+
+  return file_get_contents($CK_HOME . "/public/redeem.php?mode=name&tid=" . 
urlencode($_tid) . "&from=" . urlencode($_SERVER['REMOTE_ADDR']) . "&to=" . 
urlencode($_service));
 }
 
 $wgHooks['BeforePageDisplay'][] = 'wgck_enscript';

-- 
To view, visit https://gerrit.wikimedia.org/r/89477
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Iadcaf300c8d23e6ac1fda591257cec5148288860
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/CryoKey
Gerrit-Branch: master
Gerrit-Owner: CryoKey <[email protected]>
Gerrit-Reviewer: CryoKey <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to