You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@milagro.apache.org by ni...@apache.org on 2016/07/14 18:04:47 UTC

[4/7] incubator-milagro-mfa-js-client git commit: Show status of mobile authentication

Show status of mobile authentication

Enable the client to show messages based on what stage the mobile
authentication is at the moment

1) QR Scanned
2) Profile to be authenticated choosen
3) Waiting for authentication
4) Authenticate

Most changes are in the related milagro-js-lib


Project: http://git-wip-us.apache.org/repos/asf/incubator-milagro-mfa-js-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-milagro-mfa-js-client/commit/513d0d9d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-milagro-mfa-js-client/tree/513d0d9d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-milagro-mfa-js-client/diff/513d0d9d

Branch: refs/heads/master
Commit: 513d0d9d4c7625c7c17d27aef7336d405f10a37f
Parents: f6fe492
Author: Pavlin Angelov <pa...@miracl.com>
Authored: Tue Jun 7 11:55:35 2016 +0300
Committer: Pavlin Angelov <pa...@miracl.com>
Committed: Tue Jun 7 11:55:35 2016 +0300

----------------------------------------------------------------------
 browser/js/mpin.js | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-milagro-mfa-js-client/blob/513d0d9d/browser/js/mpin.js
----------------------------------------------------------------------
diff --git a/browser/js/mpin.js b/browser/js/mpin.js
index acf8429..6993034 100644
--- a/browser/js/mpin.js
+++ b/browser/js/mpin.js
@@ -1115,9 +1115,30 @@ var mpin = mpin || {};
       }
 
       self.successLogin.call(self, accData);
+    }, function (accData) {
+        return self.updateStatus(accData);;
     });
   };
 
+  mpin.prototype.updateStatus = function (statusData) {
+    var statusText;
+
+    switch (statusData.status) {
+      case "wid":
+        statusText = "<span>Code scanned.<br/>Waiting for authentication...</span>";
+        break;
+      case "user":
+        statusText = "<span>Authenticating user:<br/>" + statusData.userId + "</span>";
+        break;
+      case "expired":
+        statusText = "<span>Authentication expired!</span>";
+        break;
+    }
+
+    document.getElementById("mp_qrcode").removeAttribute('title');
+    statusText && (document.getElementById("mp_qrcode").innerHTML = statusText);
+  };
+
   mpin.prototype.renderMobileSetup = function () {
     var callbacks = {}, self = this, qrElem, mobileBtnText = "";
     callbacks.mpin_home = function () {