Pman.Dialog.BAdminPassword.bjs
authorjohn <john@roojs.com>
Wed, 10 Oct 2018 05:03:09 +0000 (13:03 +0800)
committerjohn <john@roojs.com>
Wed, 10 Oct 2018 05:03:09 +0000 (13:03 +0800)
Pman.Dialog.BAdminPassword.js

Pman.Dialog.BAdminPassword.bjs
Pman.Dialog.BAdminPassword.js

index fb6b156..a80dbf9 100644 (file)
             {
              "listeners" : {
               "check" : "function (_self, checked)\n{\n    if(checked) {\n        this.setBoxLabel('Untick to disable Two Factor authentication');\n        return;\n    }\n    \n    this.setBoxLabel('Enable Two Factor Authentication');\n}",
-              "click" : "function (_self, e)\n{\n    e.preventDefault();\n    \n    if(!this.checked) {\n        Pman.Dialog.BAdminStaffTwoFactorQRCode.show(\n            {id: Pman.Login.authUser.id},\n            function(){_this.dialog.hide({})}\n        );\n        return;\n    }\n    \n    if(!Pman.Login.authUser) {\n        Roo.bootstrap.MessageBox.alert('Error', 'Please login again');\n        return;\n    }\n    \n    new Pman.Request({\n        url : baseURL + '/Roo/Core_person',\n        method :'GET',\n        params : {\n            oath_key_disable: 1,\n            id: Pman.Login.authUser.id\n        },\n        \n        success : function(res)\n        {\n            switch(res.data) {\n                case 'DONE':\n                    Roo.bootstrap.MessageBox.alert('Success', 'The two factor authentication has been disabled');\n                    break;\n                default:\n                    Roo.log('invalid usage');\n                    break;\n            }\n        },\n        \n        failure : function(res)\n        {\n            Roo.bootstrap.MessageBox.alert('Error', res);\n        }\n    });\n}"
+              "click" : "function (_self, e)\n{\n    e.preventDefault();\n    \n    if(!this.checked) {\n        Pman.Dialog.BAdminStaffTwoFactorQRCode.show(\n            {id: Pman.Login.authUser.id},\n            function(valid){\n                if(valid) {\n                    _this.dialog.hide({});\n                    return;\n                }\n            }\n        );\n        return;\n    }\n    \n    if(!Pman.Login.authUser) {\n        Roo.bootstrap.MessageBox.alert('Error', 'Please login again');\n        return;\n    }\n    \n    new Pman.Request({\n        url : baseURL + '/Roo/Core_person',\n        method :'GET',\n        params : {\n            oath_key_disable: 1,\n            id: Pman.Login.authUser.id\n        },\n        \n        success : function(res)\n        {\n            switch(res.data) {\n                case 'DONE':\n                    Roo.bootstrap.MessageBox.alert('Success', 'The two factor authentication has been disabled');\n                    break;\n                default:\n                    Roo.log('invalid usage');\n                    break;\n            }\n        },\n        \n        failure : function(res)\n        {\n            Roo.bootstrap.MessageBox.alert('Error', res);\n        }\n    });\n}"
              },
              "String name" : "_enable_oath_key",
              "Boolean checked" : false,
index 0ed9bf8..93b5212 100644 (file)
@@ -274,7 +274,12 @@ Roo.apply(Pman.Dialog.BAdminPassword.prototype, {
                     if(!this.checked) {
                         Pman.Dialog.BAdminStaffTwoFactorQRCode.show(
                             {id: Pman.Login.authUser.id},
-                            function(){_this.dialog.hide({})}
+                            function(valid){
+                                if(valid) {
+                                    _this.dialog.hide({});
+                                    return;
+                                }
+                            }
                         );
                         return;
                     }