PHP8
[Pman.BAdmin] / Pman.Dialog.BAdminPassword.bjs
1 {
2  "name" : "Pman.Dialog.BAdminPassword",
3  "parent" : "",
4  "title" : "",
5  "path" : "/home/edward/gitlive/Pman.BAdmin/Pman.Dialog.BAdminPassword.bjs",
6  "permname" : "",
7  "modOrder" : "001",
8  "strings" : {
9   "9182ecb4943f2724adde82c820702555" : "Retype New Password",
10   "8f1e77e0d2be21da93cd4d9a939148f7" : "Change Password",
11   "ea4788705e6873b424c65e91c2846b19" : "Cancel",
12   "ae3bb2a1ac61750150b606298091d38a" : "New Password",
13   "51eea3dc60ae3a0b1bb8188bc6337dc2" : "enter password",
14   "bb78dd7992509064b8044b7afe6ec9ed" : "Update Password",
15   "828e70f83623b262e14187c039df99c0" : "Enable Two-Factor Authentication"
16  },
17  "named_strings" : {
18   "changePassword_placeholder" : "51eea3dc60ae3a0b1bb8188bc6337dc2",
19   "passwd2_fieldLabel" : "9182ecb4943f2724adde82c820702555",
20   "passwd1_fieldLabel" : "ae3bb2a1ac61750150b606298091d38a",
21   "_enable_oath_key_boxLabel" : "828e70f83623b262e14187c039df99c0"
22  },
23  "items" : [
24   {
25    "String cls" : "enable-overflow",
26    "xtype" : "Modal",
27    "$ xns" : "Roo.bootstrap",
28    "String title" : "Change Password",
29    "items" : [
30     {
31      "listeners" : {
32       "render" : "function (_self)\n{\n    _this.cancel_btn = this;\n}",
33       "click" : "function (_self, e)\n{\n    _this.dialog.hide({});\n}"
34      },
35      "xtype" : "Button",
36      "$ xns" : "Roo.bootstrap",
37      "String html" : "Cancel",
38      "* prop" : "buttons[]"
39     },
40     {
41      "listeners" : {
42       "render" : "function (_self)\n{\n    _this.submit_button = this;\n}",
43       "click" : "function (_self, e)\n{\n    var p1 = _this.form.findField('passwd1').getValue();\n    var p2 = _this.form.findField('passwd2').getValue();\n    \n    if(\n        !p1.length ||\n        !p2.length ||\n        p1 !== p2\n    ) {\n        Roo.bootstrap.MessageBox.alert(\"Error\", \"Passwords do not match\");\n        return;\n    }\n    \n    _this.form.findField('changePassword').setValue(1);\n    \n    this.changeStatus('submit');\n    \n    _this.form.doAction('submit');\n}"
44      },
45      "String weight" : "primary",
46      "xtype" : "Button",
47      "| function changeStatus" : "function(status)\n{\n    switch(status) {\n        \n        case 'submit':\n            this.disable();\n            this.setText('sending...');\n            break;\n            \n        case 'loaded':\n            this.enable();\n            this.setText('OK');\n            break;\n        \n        default:\n            break;\n    }\n}",
48      "$ xns" : "Roo.bootstrap",
49      "String html" : "Update Password",
50      "* prop" : "buttons[]"
51     },
52     {
53      "xtype" : "Container",
54      "$ xns" : "Roo.bootstrap",
55      "String style" : "width: 100%",
56      "items" : [
57       {
58        "listeners" : {
59         "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}",
60         "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}",
61         "render" : "function (_self)\n{\n    _this.form = this;\n}"
62        },
63        "$ url" : "baseURL+'/Login'",
64        "xtype" : "Form",
65        "$ xns" : "Roo.bootstrap",
66        "String method" : "POST",
67        "items" : [
68         {
69          "xtype" : "Row",
70          "$ xns" : "Roo.bootstrap",
71          "items" : [
72           {
73            "xtype" : "Column",
74            "Number xs" : 12,
75            "$ xns" : "Roo.bootstrap",
76            "items" : [
77             {
78              "listeners" : {
79               "change" : "function (_self, newValue, oldValue)\n{\n    _this.form.findField('passwd2').markInvalid();\n}"
80              },
81              "Boolean allowBlank" : false,
82              "String name" : "passwd1",
83              "xtype" : "Input",
84              "String labelAlign" : "top",
85              "string fieldLabel" : "New Password",
86              "String inputType" : "password",
87              "$ xns" : "Roo.bootstrap"
88             },
89             {
90              "listeners" : {
91               "valid" : "function (_self)\n{\n    if (_this.form.findField('passwd1').getValue() !== _this.form.findField('passwd2').getValue()){\n        _this.form.findField('passwd2').markInvalid();\n    }\n}"
92              },
93              "Boolean allowBlank" : false,
94              "String name" : "passwd2",
95              "xtype" : "Input",
96              "String labelAlign" : "top",
97              "string fieldLabel" : "Retype New Password",
98              "String inputType" : "password",
99              "$ xns" : "Roo.bootstrap"
100             },
101             {
102              "Boolean allowBlank" : false,
103              "String name" : "changePassword",
104              "xtype" : "Input",
105              "string placeholder" : "enter password",
106              "String labelAlign" : "top",
107              "String inputType" : "hidden",
108              "$ xns" : "Roo.bootstrap"
109             },
110             {
111              "listeners" : {
112               "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}",
113               "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}"
114              },
115              "String name" : "_enable_oath_key",
116              "Boolean checked" : false,
117              "xtype" : "CheckBox",
118              "String boxLabel" : "Enable Two-Factor Authentication",
119              "$ xns" : "Roo.bootstrap"
120             }
121            ]
122           }
123          ]
124         }
125        ]
126       }
127      ]
128     }
129    ]
130   }
131  ]
132 }