PHP8
[Pman.BAdmin] / Pman.Dialog.BAdminPassword.bjs
index 99a4191..ee4d248 100644 (file)
@@ -2,7 +2,7 @@
  "name" : "Pman.Dialog.BAdminPassword",
  "parent" : "",
  "title" : "",
- "path" : "/home/john/gitlive/web.coba/Pman/BAdmin/Pman.Dialog.BAdminPassword.bjs",
+ "path" : "/home/edward/gitlive/Pman.BAdmin/Pman.Dialog.BAdminPassword.bjs",
  "permname" : "",
  "modOrder" : "001",
  "strings" : {
@@ -57,8 +57,8 @@
       {
        "listeners" : {
         "actionfailed" : "function (_self, action)\n{\n    if (action.type =='submit') {\n        \n        _this.submit_button.changeStatus('loaded');\n        \n        if (_this.callback) {\n            _this.callback.call(_this, action.result);\n        }\n    }\n}",
-        "actioncomplete" : "function (_self, action)\n{\n    if(action.type == 'setdata'){\n        \n        _this.form.clearInvalid();\n        \n        _this.form.findField('_enable_oath_key').setChecked(false,true);\n       \n        new Pman.Request({\n            url: baseURL + '/Login.php',\n            method: 'POST',\n            params: {\n                getAuthUser: true\n            }, \n            success: function(res) {\n                \n                if(res.data.oath_key_enable) {\n                    _this.form.findField('_enable_oath_key').setChecked(true,true);\n                }\n            }\n        });\n    }\n    \n    if (action.type == 'load') {\n        \n        Roo.log('invalid usage');\n    }\n    \n    if (action.type =='submit') {\n        \n        if (_this.callback) {\n            _this.callback.call(_this, action.result);\n        }\n        \n        _this.form.reset();\n        \n        _this.submit_button.changeStatus('loaded');\n        \n        _this.dialog.hide({});\n        \n        return;\n    }\n}",
-        "render" : "function (_self)\n{\n    _this.form = _self;\n}"
+        "actioncomplete" : "function (_self, action)\n{\n    if(action.type == 'setdata'){\n        \n        _this.form.reset();\n        \n        _this.form.clearInvalid();\n        \n        _this.form.findField('_enable_oath_key').setChecked(false,false);\n       \n        new Pman.Request({\n            url: baseURL + '/Login.php',\n            method: 'POST',\n            params: {\n                getAuthUser: true\n            }, \n            success: function(res) {\n                \n                if(res.data.oath_key_enable) {\n                    _this.form.findField('_enable_oath_key').setChecked(true,false);\n                }\n            }\n        });\n    }\n    \n    if (action.type == 'load') {\n        \n        Roo.log('invalid usage');\n    }\n    \n    if (action.type =='submit') {\n        \n        if (_this.callback) {\n            _this.callback.call(_this, action.result);\n        }\n        \n        _this.form.reset();\n        \n        _this.submit_button.changeStatus('loaded');\n        \n        _this.dialog.hide({});\n        \n        return;\n    }\n}",
+        "render" : "function (_self)\n{\n    _this.form = this;\n}"
        },
        "$ url" : "baseURL+'/Login'",
        "xtype" : "Form",
             },
             {
              "listeners" : {
-              "check" : "function (_self, checked)\n{\n    // keep firing when showing a dialog with checked checkbox...\n\n    if(!_this.getEl().isVisible()) {\n        return;\n    }\n\n    if(checked) {\n        \n        Pman.Dialog.BAdminStaffTwoFactorQRCode.show({});\n        \n        this.setBoxLabel('Untick to disable Two Factor authentication');\n        \n        return;\n    }\n    \n    this.setBoxLabel('Enable Two Factor Authentication');\n}"
+              "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    if(!Pman.Login.authUser) {\n        Roo.bootstrap.MessageBox.alert('Error', 'Please login again');\n        return;\n    }\n    \n    e.preventDefault();\n    \n    if(!this.checked) {\n        Pman.Dialog.BAdminStaffTwoFactorQRCode.show({\n            id: Pman.Login.authUser.id,\n            allow_close: false,\n            allow_cancel : true\n        }, function(valid){\n                if(valid) {\n                    _this.dialog.hide({});\n                    return;\n                }\n                \n                _this.form.findField('_enable_oath_key').setChecked(false,false);\n            }\n        );\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,