26427d79657191045eb1f097e87947e1725b8bb2
[Pman.BAdmin] / Pman.Dialog.Login.bjs
1 {
2  "name" : "Pman.Dialog.Login",
3  "parent" : "",
4  "title" : "",
5  "path" : "/home/veridate/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   "5047040b025ce0295b58d42250014417" : "<div id=\"login-err\" class=\"dialog-err\" style=\"color:red\"></div>",
17   "24efa7ee4511563b16144f39706d594f" : "Notice",
18   "643a860f992333b8600ea264aca7c4fc" : "Email Address"
19  },
20  "named_strings" : {
21   "username_placeholder" : "643a860f992333b8600ea264aca7c4fc",
22   "_force_value" : "cfcd208495d565ef66e7dff9f98764da",
23   "password_placeholder" : "dc647eb65e6711e155375218212b3964",
24   "oath_password_placeholder" : "06cf692a8d2bb0ab8318dc6c839ae931",
25   "OK_html" : "99dea78007133396a7b8ed70578ac6ae"
26  },
27  "items" : [
28   {
29    "listeners" : {
30     "btnclick" : "function (e)\n{\n    if(e == 'cancel'){\n        _this.dialog.hide();\n        return;\n    }\n    \n    _this.dialog.el.select('.modal-content', true).first().mask('Sending...');\n    _this.form.doAction('submit');\n}",
31     "|render" : "function (_self) {\n\n    Roo.get('login-err').dom.innerHTML = \"\";\n    _this.dialog.el.select('.modal-content', true).first().unmask();\n    \n    if(Roo.isTouch){\n        this.animate = false;\n    }\n}\n    ",
32     "show" : "function (_self)\n{\n    this.setTitle( _this.dialog._dialog_title_login );\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}"
33    },
34    "String cls" : "enable-overflow login-dialog padding-bottom-trim",
35    "Boolean allow_close" : false,
36    "xtype" : "Modal",
37    "buttonPosition" : "center",
38    "$ xns" : "Roo.bootstrap",
39    "string _dialog_title_login" : "Login to the Management Portal",
40    "items" : [
41     {
42      "listeners" : {
43       "render" : "function (_self)\n{\n    _this.login = this;\n    \n    this.el.setVisibilityMode(Roo.Element.DISPLAY);\n}"
44      },
45      "xtype" : "Row",
46      "$ xns" : "Roo.bootstrap",
47      "items" : [
48       {
49        "xtype" : "Column",
50        "Number xs" : 12,
51        "$ xns" : "Roo.bootstrap",
52        "items" : [
53         {
54          "xtype" : "Row",
55          "$ xns" : "Roo.bootstrap",
56          "items" : [
57           {
58            "xtype" : "Container",
59            "cls" : "col-md-12",
60            "$ xns" : "Roo.bootstrap",
61            "items" : [
62             {
63              "listeners" : {
64               "|actioncomplete" : "function (_self, action) {\n    \n    if(action.type == 'setdata'){\n\n        if(\n            _this.lastLogin && \n            _this.lastLogin.login_provider == ''\n        ){\n            _this.form.findField('username').setValue(_this.lastLogin.email);\n        }\n        \n        Roo.get('login-err').dom.innerHTML = \"\";\n        _this.errorRow.hide();\n        _this.dialog.el.select('.modal-content', true).first().unmask();\n        this.clearInvalid();\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},\n                        cb\n                    )\n                }\n            });\n            \n            return;\n        }\n        \n        cb();\n    }\n}",
65               "|render" : "function (_self) {\n    _this.form = _self;\n}",
66               "|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    \n    if (typeof(action) != 'undefined' && action.failureType == 'server') {\n        \n        switch (action.result.errorMsg) {\n                    \n            case 'Authenticated' :\n                \n                var data = Roo.apply(action.result.errors);\n                \n                data.target = _this.form.findField('username').getValue();\n                \n                Roo.bootstrap.MessageBox.alert(\"Error\", \"odd error messages\");\n                \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                \n                Pman.Dialog.LoginNotice.show({\n                    status : action.result.errorMsg,\n                    ip : action.result.errors.ip\n                });\n                \n                break;\n                \n            default:\n               _this.errorRow.show();\n                Roo.get('login-err').dom.innerHTML = action.result.errorMsg;\n                break;\n        }\n        \n        return;\n    }\n    \n    Roo.get('login-err').dom.innerHTML = \"Fill in all the required fields\";\n}"
67              },
68              "$ url" : "baseURL + '/Login'",
69              "labelAlign" : "left",
70              "xtype" : "Form",
71              "method" : "POST",
72              "$ xns" : "Roo.bootstrap",
73              "Boolean loadMask" : false,
74              "items" : [
75               {
76                "xtype" : "Container",
77                "cls" : "col-sm-12",
78                "$ xns" : "Roo.bootstrap",
79                "items" : [
80                 {
81                  "listeners" : {
82                   "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}"
83                  },
84                  "inputType" : "email",
85                  "xtype" : "Input",
86                  "vtype" : "email",
87                  "placeholder" : "Email Address",
88                  "allowBlank" : false,
89                  "$ xns" : "Roo.bootstrap",
90                  "name" : "username"
91                 },
92                 {
93                  "listeners" : {
94                   "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}"
95                  },
96                  "inputType" : "password",
97                  "placeholder" : "Password",
98                  "xtype" : "Input",
99                  "allowBlank" : false,
100                  "$ xns" : "Roo.bootstrap",
101                  "name" : "password"
102                 },
103                 {
104                  "listeners" : {
105                   "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}"
106                  },
107                  "Number maxLength" : 6,
108                  "Boolean allowZero" : 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              "xtype" : "Container",
147              "style" : "margin-bottom: 15px;\n    padding: 5px;",
148              "cls" : "bg-danger",
149              "html" : "<div id=\"login-err\" class=\"dialog-err\" style=\"color:red\"></div>",
150              "$ xns" : "Roo.bootstrap"
151             }
152            ]
153           }
154          ]
155         }
156        ]
157       }
158      ]
159     },
160     {
161      "xtype" : "Button",
162      "$ string weight" : "'primary'",
163      "html" : "Login",
164      "$ xns" : "Roo.bootstrap",
165      "String style" : "float: right",
166      "* prop" : "buttons[]",
167      "string name" : "OK"
168     },
169     {
170      "listeners" : {
171       "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);\n    });\n}"
172      },
173      "String tag" : "a",
174      "String href" : "#",
175      "xtype" : "Button",
176      "html" : "Forgot your password ?",
177      "$ string weight" : "'link'",
178      "string _forgot_passwd_success_title" : "Notice",
179      "Boolean removeClass" : true,
180      "$ xns" : "Roo.bootstrap",
181      "String style" : "float: left",
182      "* prop" : "buttons[]",
183      "string _forgot_passwd_success_body" : "We have sent you a link to reset your password"
184     }
185    ]
186   }
187  ]
188 }