PHP8
[Pman.BAdmin] / Pman.Dialog.Login.bjs
1 {
2  "name" : "Pman.Dialog.Login",
3  "parent" : "",
4  "title" : "",
5  "path" : "/home/alan/gitlive/Pman.BAdmin/Pman.Dialog.Login.bjs",
6  "permname" : "",
7  "modOrder" : "001",
8  "strings" : {
9   "e50b62fb8271673bacc2cfd9d80fbe7a" : "Login to the Management Portal",
10   "99dea78007133396a7b8ed70578ac6ae" : "Login",
11   "cfcd208495d565ef66e7dff9f98764da" : "0",
12   "cd4bcecae78474ea24c3f28350758a8c" : "Forgot your password ?",
13   "dc647eb65e6711e155375218212b3964" : "Password",
14   "06cf692a8d2bb0ab8318dc6c839ae931" : "Two-Factor Authentication Number (if relevant)",
15   "11163ed17ad9afc7680bb9e92f15d6fd" : "We have sent you a link to reset your password",
16   "24efa7ee4511563b16144f39706d594f" : "Notice",
17   "643a860f992333b8600ea264aca7c4fc" : "Email Address"
18  },
19  "named_strings" : {
20   "username_placeholder" : "643a860f992333b8600ea264aca7c4fc",
21   "_force_value" : "cfcd208495d565ef66e7dff9f98764da",
22   "password_placeholder" : "dc647eb65e6711e155375218212b3964",
23   "oath_password_placeholder" : "06cf692a8d2bb0ab8318dc6c839ae931",
24   "OK_html" : "99dea78007133396a7b8ed70578ac6ae"
25  },
26  "items" : [
27   {
28    "listeners" : {
29     "btnclick" : "function (e)\n{\n    if(e == 'cancel'){\n        _this.dialog.hide();\n        return;\n    }\n    _this.alert.hide();\n    _this.dialog.el.select('.modal-content', true).first().mask('Sending...');\n    _this.form.doAction('submit');\n}",
30     "|render" : "function (_self) {\n\n \n    _this.dialog.el.select('.modal-content', true).first().unmask();\n    \n    if(Roo.isTouch){\n        this.animate = false;\n    }\n}\n    ",
31     "show" : "function (_self)\n{\n    this.setTitle( _this.dialog._dialog_title_login );\n    \n  \n}"
32    },
33    "String cls" : "enable-overflow login-dialog padding-bottom-trim",
34    "Boolean allow_close" : false,
35    "xtype" : "Modal",
36    "buttonPosition" : "center",
37    "$ xns" : "Roo.bootstrap",
38    "string _dialog_title_login" : "Login to the Management Portal",
39    "items" : [
40     {
41      "listeners" : {
42       "render" : "function (_self)\n{\n    _this.login = this;\n    \n    this.el.setVisibilityMode(Roo.Element.DISPLAY);\n}"
43      },
44      "xtype" : "Row",
45      "$ xns" : "Roo.bootstrap",
46      "items" : [
47       {
48        "xtype" : "Column",
49        "Number xs" : 12,
50        "$ xns" : "Roo.bootstrap",
51        "items" : [
52         {
53          "xtype" : "Row",
54          "$ xns" : "Roo.bootstrap",
55          "items" : [
56           {
57            "xtype" : "Container",
58            "cls" : "col-md-12",
59            "$ xns" : "Roo.bootstrap",
60            "items" : [
61             {
62              "listeners" : {
63               "|actionfailed" : "function (_self, action) {\n    Roo.log('action failed?!');\n    Roo.log(action);\n    \n    _this.dialog.el.select('.modal-content', true).first().unmask();\n    _this.alert.show();\n    if (typeof(action) != 'undefined' && action.failureType == 'server') {\n        \n        switch (action.result.code) {\n                    \n            case 'Authenticated' :\n                \n                 \n                Roo.bootstrap.MessageBox.alert(\"Error\",action.result.errorMsg);\n                _this.alert.setHtml(action.result.errorMsg);\n                break;\n                \n            case 'NEW-IP-ADDRESS' :\n            case 'PENDING-IP-ADDRESS' :\n            case 'BAD-IP-ADDRESS' :\n            case 'BLOCKED-IP-ADDRESS' :\n                \n                _this.dialog.hide();\n                Roo.bootstrap.MessageBox.alert(\"Error\", action.result.errorMsg);\n                //Pman.Dialog.LoginNotice.show({\n                  //  status : action.result.errorMsg,\n                  //  ip : action.result.errors.ip\n                //});\n                \n                break;\n             case 'LOGIN-2FA':\n                this.findField('username').hide();\n                this.findField('password').hide();\n                this.findField('oath_password').show();\n                return; // no way back from here..\n             \n            default:\n               _this.errorRow.show();\n                _this.alert.setHtml(action.result.errorMsg);\n                break;\n        }\n        \n        return;\n    }\n    \n    _this.alert.setHtml( \"Fill in all the required fields\");\n}",
64               "|actioncomplete" : "function (_self, action) {\n   \n   \n     if (!Roo.state.Manager.getProvider().expires) {\n        Roo.state.Manager.setProvider(new Roo.state.CookieProvider());\n    }\n    \n    _this.lastLogin = Roo.state.Manager.get('Pman.Login', {});\n    _this.form.findField('username').focus();\n    \n    \n    if(action.type == 'setdata'){\n\n        this.findField('username').show();\n        this.findField('password').show();\n        this.findField('oath_password').hide();\n\n\n        _this.errorRow.hide();\n        _this.dialog.el.select('.modal-content', true).first().unmask();\n        this.clearInvalid();\n        if(\n            _this.lastLogin && \n            _this.lastLogin.username != ''\n        ){\n            \n            _this.form.findField('username').setValue(_this.lastLogin.username);\n             _this.form.findField('password').focus();\n        }\n        return;\n    }\n     \n    if(action.type == 'load'){\n        \n        return;\n    }\n    \n    if (action.type =='submit') {\n        \n        _this.dialog.hide();\n        \n        var cb = function(){\n            if (_this.callback) {\n                _this.callback.call(_this, action.result);\n            }\n            \n            _this.form.reset();\n            \n            return;\n        }\n        \n        if(\n            !action.result.data.oath_key_enable &&\n            action.result.data.require_oath * 1 == 1\n        ) {\n            Roo.bootstrap.MessageBox.show({\n                title : \"Two Factor Authentication is required\",\n                closable : false,\n                msg : \"This system requires that you use Google Two Factor Authentication.\",\n                buttons : {yes:'Setup Two Factor Authentication'},\n                fn : function(ret){\n                    if(ret != 'yes'){\n                         return;\n                     }\n                    \n                    Pman.Dialog.BAdminStaffTwoFactorQRCode.show(\n                        {id: action.result.data.id, allow_close : true },\n                        cb\n                    );\n                }\n            });\n            \n            return;\n        }\n        // store only username\n        Roo.state.Manager.set('Pman.Login', {\n              username : this.findField('username').getValue() \n        });\n        cb();\n    }\n}",
65               "|render" : "function (_self) {\n    _this.form = _self;\n}"
66              },
67              "$ url" : "baseURL + '/Login'",
68              "labelAlign" : "left",
69              "xtype" : "Form",
70              "method" : "POST",
71              "$ xns" : "Roo.bootstrap",
72              "Boolean loadMask" : false,
73              "items" : [
74               {
75                "xtype" : "Container",
76                "cls" : "col-sm-12",
77                "$ xns" : "Roo.bootstrap",
78                "items" : [
79                 {
80                  "listeners" : {
81                   "specialkey" : "function (_self, e)\n{\n    if(e.getKey() == 13){\n        _this.dialog.el.select('.modal-content', true).first().mask('Sending...');\n        _this.form.doAction('submit');\n    }\n    \n}"
82                  },
83                  "inputType" : "email",
84                  "xtype" : "Input",
85                  "vtype" : "email",
86                  "placeholder" : "Email Address",
87                  "allowBlank" : false,
88                  "$ xns" : "Roo.bootstrap",
89                  "name" : "username"
90                 },
91                 {
92                  "listeners" : {
93                   "specialkey" : "function (_self, e)\n{\n    if(e.getKey() == 13){\n        _this.dialog.el.select('.modal-content', true).first().mask('Sending...');\n        _this.form.doAction('submit');\n    }\n}"
94                  },
95                  "inputType" : "password",
96                  "placeholder" : "Password",
97                  "xtype" : "Input",
98                  "allowBlank" : false,
99                  "$ xns" : "Roo.bootstrap",
100                  "name" : "password"
101                 },
102                 {
103                  "listeners" : {
104                   "specialkey" : "function (_self, e)\n{\n    if(e.getKey() == 13){\n        _this.dialog.el.select('.modal-content', true).first().mask('Sending...');\n        _this.form.doAction('submit');\n    }\n}"
105                  },
106                  "Number maxLength" : 6,
107                  "Boolean allowZero" : true,
108                  "bool hidden" : true,
109                  "placeholder" : "Two-Factor Authentication Number (if relevant)",
110                  "xtype" : "NumberField",
111                  "Boolean allowDecimals" : false,
112                  "allowBlank" : true,
113                  "Number decimalPrecision" : 0,
114                  "$ xns" : "Roo.bootstrap",
115                  "Boolean allowNegative" : false,
116                  "name" : "oath_password"
117                 },
118                 {
119                  "inputType" : "hidden",
120                  "xtype" : "Input",
121                  "$ xns" : "Roo.bootstrap",
122                  "string value" : 0,
123                  "name" : "_force"
124                 }
125                ]
126               }
127              ]
128             }
129            ]
130           }
131          ]
132         },
133         {
134          "listeners" : {
135           "render" : "function (_self)\n{\n    _this.errorRow = this;\n}"
136          },
137          "xtype" : "Row",
138          "$ xns" : "Roo.bootstrap",
139          "items" : [
140           {
141            "xtype" : "Container",
142            "cls" : "col-md-12",
143            "$ xns" : "Roo.bootstrap",
144            "items" : [
145             {
146              "listeners" : {
147               "render" : "function (_self)\n{\n_this.alert = this;\n}"
148              },
149              "String weight" : "danger",
150              "xtype" : "Alert",
151              "$ xns" : "Roo.bootstrap"
152             }
153            ]
154           }
155          ]
156         }
157        ]
158       }
159      ]
160     },
161     {
162      "xtype" : "Button",
163      "$ string weight" : "'primary'",
164      "html" : "Login",
165      "$ xns" : "Roo.bootstrap",
166      "String style" : "float: right",
167      "* prop" : "buttons[]",
168      "string name" : "OK"
169     },
170     {
171      "listeners" : {
172       "click" : "function () {\n\n    _this.dialog.hide();\n    \n    var email = _this.form.findField('username').getValue();\n    \n    var _self = this;\n    \n    Pman.Dialog.BAdminForgotPassword.show({email : email}, function(){\n        Roo.bootstrap.MessageBox.alert(_self._forgot_passwd_success_title, _self._forgot_passwd_success_body, function() {\n                _this.dialog.show();\n        });\n\n    });\n}"
173      },
174      "String tag" : "a",
175      "String cls" : "login-forgot-pass-btn",
176      "String href" : "#",
177      "xtype" : "Button",
178      "html" : "Forgot your password ?",
179      "$ string weight" : "'link'",
180      "string _forgot_passwd_success_title" : "Notice",
181      "Boolean removeClass" : true,
182      "$ xns" : "Roo.bootstrap",
183      "String style" : "float: left",
184      "* prop" : "buttons[]",
185      "string _forgot_passwd_success_body" : "We have sent you a link to reset your password"
186     }
187    ]
188   }
189  ]
190 }