Pman.Dialog.Login.bjs
authorjohn <john@roojs.com>
Wed, 10 Oct 2018 09:47:56 +0000 (17:47 +0800)
committerjohn <john@roojs.com>
Wed, 10 Oct 2018 09:47:56 +0000 (17:47 +0800)
Pman.Dialog.Login.js

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

index 306d43d..4b55fc6 100644 (file)
@@ -63,7 +63,7 @@
              "listeners" : {
               "|render" : "function (_self) {\n    _this.form = _self;\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    \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}",
-              "|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.disable_oath\n        ) {\n            Roo.bootstrap.MessageBox.show(\n                \"Missing Two Factor Authentication\",\n                \"This is a secure system using Google Two Factor Authentication. Please click 'Confirm' for setup.\",\n                function(){\n                    Pman.Dialog.BAdminStaffTwoFactorQRCode.show(\n                        {id: action.result.data.id},\n                        cb\n                    )\n                }\n            );\n            \n            /*\n            Pman.Dialog.BAdminStaffTwoFactorQRCode.show(\n                {id: action.result.data.id},\n                cb\n            );\n            */\n            return;\n        }\n        \n        cb();\n    }\n}"
+              "|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.disable_oath\n        ) {\n            Roo.bootstrap.MessageBox.show({\n                title : \"Missing Two Factor Authentication\",\n                msg : \"This is a secure system using Google Two Factor Authentication. Please click 'Confirm' for setup.\",\n                buttons : {yes:'Confirm', no:'Cancel'},\n                fn : function(){\n                    Pman.Dialog.BAdminStaffTwoFactorQRCode.show(\n                        {id: action.result.data.id},\n                        cb\n                    )\n                }\n            });\n            \n            /*\n            Pman.Dialog.BAdminStaffTwoFactorQRCode.show(\n                {id: action.result.data.id},\n                cb\n            );\n            */\n            return;\n        }\n        \n        cb();\n    }\n}"
              },
              "$ url" : "baseURL + '/Login'",
              "labelAlign" : "left",
index 8ab1529..a2ab1d8 100644 (file)
@@ -214,16 +214,17 @@ Roo.apply(Pman.Dialog.Login.prototype, {
                             !action.result.data.oath_key_enable &&
                             !action.result.data.disable_oath
                         ) {
-                            Roo.bootstrap.MessageBox.show(
-                                "Missing Two Factor Authentication",
-                                "This is a secure system using Google Two Factor Authentication. Please click 'Confirm' for setup.",
-                                function(){
+                            Roo.bootstrap.MessageBox.show({
+                                title : "Missing Two Factor Authentication",
+                                msg : "This is a secure system using Google Two Factor Authentication. Please click 'Confirm' for setup.",
+                                buttons : {yes:'Confirm', no:'Cancel'},
+                                fn : function(){
                                     Pman.Dialog.BAdminStaffTwoFactorQRCode.show(
                                         {id: action.result.data.id},
                                         cb
                                     )
                                 }
-                            );
+                            });
                             
                             /*
                             Pman.Dialog.BAdminStaffTwoFactorQRCode.show(