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