Pman.Dialog.BAdminStaffTwoFactorQRCode.bjs
[Pman.BAdmin] / Pman.Dialog.BAdminStaffTwoFactorQRCode.bjs
1 {
2  "name" : "Pman.Dialog.BAdminStaffTwoFactorQRCode",
3  "parent" : "",
4  "title" : "",
5  "path" : "/home/edward/gitlive/Pman.BAdmin/Pman.Dialog.BAdminStaffTwoFactorQRCode.bjs",
6  "permname" : "",
7  "modOrder" : "001",
8  "strings" : {
9   "dc7b0c7f9d3941532bda06cd58eec7bd" : "<ol class='qr-list' start=\"1\">\n    <li>Open Google Authenticator in your phone, and scan this QR code.</li>\n</ol>",
10   "5d412a3d8de0189df31c8f331e2e6630" : "<ol class='qr-list' start=\"2\">\n    <li>After adding this to Google Authenticator, type in the generated number below to confirm.</li>\n</ol>",
11   "ea4788705e6873b424c65e91c2846b19" : "Cancel",
12   "ee468f72ab7fe4937fb014d6fcea540b" : "Enter Two factor Authentication code",
13   "4674ee874911c910f2356ef9ec6ab7f9" : "Scan this into Google Authenticator",
14   "70d9be9b139893aa6c69b5e77e614311" : "Confirm"
15  },
16  "named_strings" : {
17   "two_factor_auth_code_fieldLabel" : "ee468f72ab7fe4937fb014d6fcea540b"
18  },
19  "items" : [
20   {
21    "listeners" : {
22     "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}"
23    },
24    "String cls" : "enable-overflow coba-qr-dialog",
25    "Boolean allow_close" : true,
26    "xtype" : "Modal",
27    "$ xns" : "Roo.bootstrap",
28    "String title" : "Scan this into Google Authenticator",
29    "items" : [
30     {
31      "listeners" : {
32       "render" : "function (_self)\n{\n    _this.cancelBtn = this;\n}",
33       "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}"
34      },
35      "String weight" : "default",
36      "xtype" : "Button",
37      "$ xns" : "Roo.bootstrap",
38      "String html" : "Cancel",
39      "* prop" : "buttons[]"
40     },
41     {
42      "listeners" : {
43       "click" : "function (_self, e)\n{\n    _this.form.doAction('submit');\n}"
44      },
45      "String weight" : "primary",
46      "xtype" : "Button",
47      "$ xns" : "Roo.bootstrap",
48      "String html" : "Confirm",
49      "* prop" : "buttons[]"
50     },
51     {
52      "xtype" : "Row",
53      "$ xns" : "Roo.bootstrap",
54      "items" : [
55       {
56        "xtype" : "Column",
57        "Number xs" : 12,
58        "$ xns" : "Roo.bootstrap",
59        "items" : [
60         {
61          "xtype" : "Container",
62          "$ xns" : "Roo.bootstrap",
63          "String well" : "sm",
64          "String html" : "<ol class='qr-list' start=\"1\">\n    <li>Open Google Authenticator in your phone, and scan this QR code.</li>\n</ol>"
65         }
66        ]
67       }
68      ]
69     },
70     {
71      "xtype" : "Row",
72      "$ xns" : "Roo.bootstrap",
73      "items" : [
74       {
75        "String cls" : "text-center",
76        "xtype" : "Column",
77        "Number xs" : 12,
78        "$ xns" : "Roo.bootstrap",
79        "items" : [
80         {
81          "listeners" : {
82           "render" : "function (_self)\n{\n    _this.qrcode_image = this;\n    \n    this.el.setVisibilityMode(Roo.Element.DISPLAY);\n    \n}"
83          },
84          "Boolean imgResponsive" : false,
85          "String cls" : "qr-code",
86          "xtype" : "Img",
87          "String src" : "about:blank",
88          "$ xns" : "Roo.bootstrap"
89         }
90        ]
91       }
92      ]
93     },
94     {
95      "xtype" : "Row",
96      "$ xns" : "Roo.bootstrap",
97      "items" : [
98       {
99        "xtype" : "Column",
100        "Number xs" : 12,
101        "$ xns" : "Roo.bootstrap",
102        "items" : [
103         {
104          "xtype" : "Container",
105          "$ xns" : "Roo.bootstrap",
106          "String well" : "sm",
107          "String html" : "<ol class='qr-list' start=\"2\">\n    <li>After adding this to Google Authenticator, type in the generated number below to confirm.</li>\n</ol>"
108         }
109        ]
110       }
111      ]
112     },
113     {
114      "xtype" : "Row",
115      "$ xns" : "Roo.bootstrap",
116      "items" : [
117       {
118        "xtype" : "Column",
119        "Number xs" : 12,
120        "$ xns" : "Roo.bootstrap",
121        "items" : [
122         {
123          "listeners" : {
124           "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}",
125           "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}",
126           "render" : "function (_self)\n{\n    _this.form = this;\n}"
127          },
128          "xtype" : "Form",
129          "$ xns" : "Roo.bootstrap",
130          "String method" : "GET",
131          "$ String url" : "baseURL + '/Roo/Core_person.php'",
132          "items" : [
133           {
134            "Boolean allowBlank" : false,
135            "Number maxLength" : 6,
136            "Boolean allowZero" : false,
137            "String name" : "two_factor_auth_code",
138            "Boolean allowDecimals" : false,
139            "xtype" : "NumberField",
140            "string fieldLabel" : "Enter Two factor Authentication code",
141            "String labelAlign" : "top",
142            "Number xs" : 12,
143            "Number decimalPrecision" : 0,
144            "$ xns" : "Roo.bootstrap",
145            "Boolean allowNegative" : false,
146            "String indicatorpos" : "right"
147           },
148           {
149            "String name" : "id",
150            "xtype" : "Input",
151            "String inputType" : "hidden",
152            "$ xns" : "Roo.bootstrap"
153           }
154          ]
155         }
156        ]
157       }
158      ]
159     }
160    ]
161   }
162  ]
163 }