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     "hide" : "function (_self)\n{\n    if(_this.callback){\n        _this.callback.call(_this, false);\n    }\n    \n}"
24    },
25    "String cls" : "enable-overflow coba-qr-dialog",
26    "Boolean animate" : false,
27    "Boolean allow_close" : true,
28    "xtype" : "Modal",
29    "$ xns" : "Roo.bootstrap",
30    "String title" : "Scan this into Google Authenticator",
31    "items" : [
32     {
33      "listeners" : {
34       "render" : "function (_self)\n{\n    _this.cancelBtn = this;\n}",
35       "click" : "function (_self, e)\n{\n    _this.dialog.hide();\n    \n    return;\n}"
36      },
37      "String weight" : "default",
38      "xtype" : "Button",
39      "$ xns" : "Roo.bootstrap",
40      "String html" : "Cancel",
41      "* prop" : "buttons[]"
42     },
43     {
44      "listeners" : {
45       "render" : "function (_self)\n{\n    _this.cancelBtn = this;\n}",
46       "click" : "function (_self, e)\n{\n    _this.dialog.hide();\n    \n    return;\n}"
47      },
48      "String weight" : "default",
49      "xtype" : "Button",
50      "$ xns" : "Roo.bootstrap",
51      "String html" : "Cancel",
52      "* prop" : "buttons[]"
53     },
54     {
55      "listeners" : {
56       "click" : "function (_self, e)\n{\n    _this.form.doAction('submit');\n}"
57      },
58      "String weight" : "primary",
59      "xtype" : "Button",
60      "$ xns" : "Roo.bootstrap",
61      "String html" : "Confirm",
62      "* prop" : "buttons[]"
63     },
64     {
65      "xtype" : "Row",
66      "$ xns" : "Roo.bootstrap",
67      "items" : [
68       {
69        "xtype" : "Column",
70        "Number xs" : 12,
71        "$ xns" : "Roo.bootstrap",
72        "items" : [
73         {
74          "xtype" : "Container",
75          "$ xns" : "Roo.bootstrap",
76          "String well" : "sm",
77          "String html" : "<ol class='qr-list' start=\"1\">\n    <li>Open Google Authenticator in your phone, and scan this QR code.</li>\n</ol>"
78         }
79        ]
80       }
81      ]
82     },
83     {
84      "xtype" : "Row",
85      "$ xns" : "Roo.bootstrap",
86      "items" : [
87       {
88        "String cls" : "text-center",
89        "xtype" : "Column",
90        "Number xs" : 12,
91        "$ xns" : "Roo.bootstrap",
92        "items" : [
93         {
94          "listeners" : {
95           "render" : "function (_self)\n{\n    _this.qrcode_image = this;\n    \n    this.el.setVisibilityMode(Roo.Element.DISPLAY);\n    \n}"
96          },
97          "Boolean imgResponsive" : false,
98          "String cls" : "qr-code",
99          "xtype" : "Img",
100          "String src" : "about:blank",
101          "$ xns" : "Roo.bootstrap"
102         }
103        ]
104       }
105      ]
106     },
107     {
108      "xtype" : "Row",
109      "$ xns" : "Roo.bootstrap",
110      "items" : [
111       {
112        "xtype" : "Column",
113        "Number xs" : 12,
114        "$ xns" : "Roo.bootstrap",
115        "items" : [
116         {
117          "xtype" : "Container",
118          "$ xns" : "Roo.bootstrap",
119          "String well" : "sm",
120          "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>"
121         }
122        ]
123       }
124      ]
125     },
126     {
127      "xtype" : "Row",
128      "$ xns" : "Roo.bootstrap",
129      "items" : [
130       {
131        "xtype" : "Column",
132        "Number xs" : 12,
133        "$ xns" : "Roo.bootstrap",
134        "items" : [
135         {
136          "listeners" : {
137           "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}",
138           "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}",
139           "render" : "function (_self)\n{\n    _this.form = this;\n}"
140          },
141          "xtype" : "Form",
142          "$ xns" : "Roo.bootstrap",
143          "String method" : "GET",
144          "$ String url" : "baseURL + '/Roo/Core_person.php'",
145          "items" : [
146           {
147            "Boolean allowBlank" : false,
148            "Number maxLength" : 6,
149            "Boolean allowZero" : false,
150            "String name" : "two_factor_auth_code",
151            "Boolean allowDecimals" : false,
152            "xtype" : "NumberField",
153            "string fieldLabel" : "Enter Two factor Authentication code",
154            "String labelAlign" : "top",
155            "Number xs" : 12,
156            "Number decimalPrecision" : 0,
157            "$ xns" : "Roo.bootstrap",
158            "Boolean allowNegative" : false,
159            "String indicatorpos" : "right"
160           },
161           {
162            "String name" : "id",
163            "xtype" : "Input",
164            "String inputType" : "hidden",
165            "$ xns" : "Roo.bootstrap"
166           }
167          ]
168         }
169        ]
170       }
171      ]
172     }
173    ]
174   }
175  ]
176 }