Pman.Dialog.BAdminStaffTwoFactorQRCode.bjs
authorEdward <edward@roojs.com>
Fri, 7 Dec 2018 04:36:11 +0000 (12:36 +0800)
committerEdward <edward@roojs.com>
Fri, 7 Dec 2018 04:36:11 +0000 (12:36 +0800)
Pman.Dialog.BAdminStaffTwoFactorQRCode.js

Pman.Dialog.BAdminStaffTwoFactorQRCode.bjs
Pman.Dialog.BAdminStaffTwoFactorQRCode.js

index 99f6a51..8232c68 100644 (file)
  "items" : [
   {
    "listeners" : {
-    "show" : "function (_self)\n{\n    if(!Pman.Login.authUser) {\n        Roo.bootstrap.MessageBox.alert('Error', 'Please login again');\n        return;\n    }\n    \n    if(\n        !_this.data.id ||\n        _this.data.id.length == 0\n    ) {\n        Roo.bootstrap.MessageBox.alert('Error', 'Please select a person again');\n        return;\n    }\n    \n    _this.dialog.closeEl.hide();\n    _this.cancelBtn.hide();\n    \n    if(_this.data.allow_close) {\n        _this.dialog.closeEl.show();\n    }\n    \n    if(_this.data.allow_cancel) {\n        _this.cancelBtn.show();\n    }\n    \n    new Pman.Request({\n        url: baseURL + '/Roo/Core_person.php',\n        method : 'GET',\n        mask : 'Loading...',\n        params : {\n            _to_qr_code : 1,\n            id: _this.data.id\n        },\n        \n        success : function(res) {\n            _this.qrcode_image.setSrc(res.data);\n        },\n        \n        failure : function(res) {\n            Roo.log(res);\n        }\n    });\n}"
+    "show" : "function (_self)\n{\n    if(!Pman.Login.authUser) {\n        Roo.bootstrap.MessageBox.alert('Error', 'Please login again');\n        return;\n    }\n    \n    if(\n        !_this.data.id ||\n        _this.data.id.length == 0\n    ) {\n        Roo.bootstrap.MessageBox.alert('Error', 'Please select a person again');\n        return;\n    }\n    \n    _this.dialog.closeEl.hide();\n    _this.cancelBtn.hide();\n    \n    if(_this.data.allow_close) {\n        _this.dialog.closeEl.show();\n    }\n    \n    if(_this.data.allow_cancel) {\n        _this.cancelBtn.show();\n    }\n    \n    new Pman.Request({\n        url: baseURL + '/Roo/Core_person.php',\n        method : 'GET',\n        mask : 'Loading...',\n        params : {\n            _to_qr_code : 1,\n            id: _this.data.id\n        },\n        \n        success : function(res) {\n            _this.qrcode_image.setSrc(res.data);\n        },\n        \n        failure : function(res) {\n            Roo.log(res);\n        }\n    });\n}",
+    "hide" : "function (_self)\n{\n    if(_this.callback){\n        _this.callback.call(_this, false);\n    }\n    \n}"
    },
    "String cls" : "enable-overflow coba-qr-dialog",
+   "Boolean animate" : false,
    "Boolean allow_close" : true,
    "xtype" : "Modal",
    "$ xns" : "Roo.bootstrap",
@@ -30,7 +32,7 @@
     {
      "listeners" : {
       "render" : "function (_self)\n{\n    _this.cancelBtn = this;\n}",
-      "click" : "function (_self, e)\n{\n    \n    _this.dialog.hide();\n    \n    if(_this.callback){\n        _this.callback.call(_this, false);\n    }\n    \n    return;\n}"
+      "click" : "function (_self, e)\n{\n    _this.dialog.hide();\n    \n    return;\n}"
      },
      "String weight" : "default",
      "xtype" : "Button",
         {
          "listeners" : {
           "actionfailed" : "function (_self, action)\n{\n    if(action.type == 'submit') {\n        \n        switch(action.result.errorMsg) {\n            case '_invalid_auth_code':\n                Roo.bootstrap.MessageBox.alert(\n                    'Invalid authentication code',\n                    'Please re-enter the latest authentication code.'\n                );\n                break;\n            default:\n                Roo.log('invalid usage');\n                break;\n        }\n    }\n}",
-          "actioncomplete" : "function (_self, action)\n{\n    if(action.type == 'setdata') {\n        \n        this.clearInvalid();\n    }\n    \n    if(action.type == 'submit') {\n        \n        switch(action.result.data) {\n            \n            case 'DONE':\n                var cb = function() {\n                    _this.dialog.hide();\n                    \n                    if(_this.callback){\n                        _this.callback.call(_this, true);\n                    }\n                };\n                \n                Roo.bootstrap.MessageBox.alert('Success', 'Two Factor authentication has been enabled', cb);\n                return;\n                \n            default:\n                Roo.log('invalid usage');\n                break;\n        }\n    }\n}",
+          "actioncomplete" : "function (_self, action)\n{\n    if(action.type == 'setdata') {\n        \n        this.clearInvalid();\n    }\n    \n    if(action.type == 'submit') {\n        \n        switch(action.result.data) {\n            \n            case 'DONE':\n                var cb = function() {\n                    _this.dialog.hide();\n                };\n                \n                Roo.bootstrap.MessageBox.alert('Success', 'Two Factor authentication has been enabled', cb);\n                return;\n                \n            default:\n                Roo.log('invalid usage');\n                break;\n        }\n    }\n}",
           "render" : "function (_self)\n{\n    _this.form = this;\n}"
          },
          "xtype" : "Form",
index 61c1c52..74e8d18 100644 (file)
@@ -45,9 +45,17 @@ Roo.apply(Pman.Dialog.BAdminStaffTwoFactorQRCode.prototype, {
   this.dialog = Roo.factory({
     xtype : 'Modal',
     allow_close : true,
+    animate : false,
     cls : 'enable-overflow coba-qr-dialog',
     title : _this._strings['4674ee874911c910f2356ef9ec6ab7f9'] /* Scan this into Google Authenticator */,
     listeners : {
+     hide : function (_self)
+      {
+          if(_this.callback){
+              _this.callback.call(_this, false);
+          }
+          
+      },
      show : function (_self)
       {
           if(!Pman.Login.authUser) {
@@ -103,13 +111,8 @@ Roo.apply(Pman.Dialog.BAdminStaffTwoFactorQRCode.prototype, {
       listeners : {
        click : function (_self, e)
         {
-            
             _this.dialog.hide();
             
-            if(_this.callback){
-                _this.callback.call(_this, false);
-            }
-            
             return;
         },
        render : function (_self)
@@ -250,10 +253,6 @@ Roo.apply(Pman.Dialog.BAdminStaffTwoFactorQRCode.prototype, {
                         case 'DONE':
                             var cb = function() {
                                 _this.dialog.hide();
-                                
-                                if(_this.callback){
-                                    _this.callback.call(_this, true);
-                                }
                             };
                             
                             Roo.bootstrap.MessageBox.alert('Success', 'Two Factor authentication has been enabled', cb);