Pman.Dialog.Login.bjs
authorAlan Knowles <alan@roojs.com>
Mon, 16 Aug 2021 07:43:57 +0000 (15:43 +0800)
committerAlan Knowles <alan@roojs.com>
Mon, 16 Aug 2021 07:43:57 +0000 (15:43 +0800)
Pman.Dialog.Login.js

Pman.Dialog.Login.bjs
Pman.Dialog.Login.js

index 53293ac..500b1d6 100644 (file)
@@ -60,7 +60,7 @@
            "items" : [
             {
              "listeners" : {
-              "|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 'BAD-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}",
+              "|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 'BAD-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}",
               "|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\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}",
               "|render" : "function (_self) {\n    _this.form = _self;\n}"
              },
index 0f579d5..3f4c4b6 100644 (file)
@@ -273,7 +273,7 @@ Roo.apply(Pman.Dialog.Login.prototype, {
                                 //});
                                 
                                 break;
-                             case 'BAD-2FA' 
+                             case 'BAD-2FA':
                                 this.findField('username').hide();
                                 this.findField('password').hide();
                                 this.findField('oath_password').show();