{
"name" : "Pman.Dialog.BAdminStaffTwoFactorQRCode",
"parent" : "",
"title" : "",
"path" : "/home/edward/gitlive/Pman.BAdmin/Pman.Dialog.BAdminStaffTwoFactorQRCode.bjs",
"permname" : "",
"modOrder" : "001",
"strings" : {
"1459eb538ddc78e1908bbd761a444395" : "1. Download an Authentication App on your phone, like \"Google Authenticator\" or \"Authy\" ",
"e8e9a5b1083b253b726d1fa7f31176f5" : "2. After adding this to Authenticator app, type in the generated number below to confirm.",
"2194867d6c27ce97cd1f0a5db8d5c95e" : "Setup 2-Factor Authentication",
"22e960368d2513a40b7467ec143440cc" : "5. After adding this to Authenticator app, type in the generated number below to confirm.",
"131e3875e777f6c9a8e510f96a4d20d2" : "Skip for now",
"f93dadd0b45b370c51bf80fb0a3eadfa" : "3. For the Account Name user \"{0}\"",
"8e5b55264e2acf73fb73b6a327bccd51" : "4. Enter the code below as \"Your Key\"",
"4141195b21d661e36e56d91f19d53273" : "2. In the App, select \"Create or Setup an Account\"",
"ea4788705e6873b424c65e91c2846b19" : "Cancel",
"ee468f72ab7fe4937fb014d6fcea540b" : "Enter Two factor Authentication code",
"6d9785b18748c30bb3adbf7506f40202" : "1. Open Authenticator App in your phone, and scan this QR code.",
"780573538d031cf7387477f9ea3204f6" : "Copy Key",
"70d9be9b139893aa6c69b5e77e614311" : "Confirm"
},
"named_strings" : {
"two_factor_auth_code_fieldLabel" : "ee468f72ab7fe4937fb014d6fcea540b"
},
"items" : [
{
"listeners" : {
"show" : "function (_self)\n{\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 _this.dialog.closeEl.hide();\n _this.skipBtn.hide();\n _this.cancelBtn.hide();\n \n if(_this.data.allow_close) {\n _this.dialog.closeEl.show();\n _this.skipBtn.show();\n }\n \n if(_this.data.allow_cancel) {\n _this.cancelBtn.show();\n }\n \n _this.desktopView.hide();\n _this.mobileView.hide();\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.image);\n _this.secret.setValue(res.data.secret);\n _this.issuer_notify.el.dom.innerHTML = String.format(_this.issuer_notify._html, res.data.issuer);\n \n _this.desktopView.show();\n _this.mobileView.hide();\n \n if(Roo.isTouch) {\n _this.desktopView.hide();\n _this.mobileView.show();\n }\n },\n \n failure : function(res) {\n Roo.log(res);\n }\n });\n}",
"hide" : "function (_self)\n{\n if(_this.callback){\n _this.callback.call(_this, false);\n }\n \n}"
},
"String cls" : "enable-overflow coba-qr-dialog",
"Boolean animate" : false,
"Boolean allow_close" : true,
"xtype" : "Modal",
"$ xns" : "Roo.bootstrap",
"String title" : "Setup 2-Factor Authentication",
"items" : [
{
"listeners" : {
"render" : "function (_self)\n{\n _this.skipBtn = this;\n}",
"click" : "function (_self, e)\n{\n _this.dialog.hide();\n \n return;\n}"
},
"String weight" : "default",
"xtype" : "Button",
"$ xns" : "Roo.bootstrap",
"String html" : "Skip for now",
"* prop" : "buttons[]"
},
{
"listeners" : {
"render" : "function (_self)\n{\n _this.cancelBtn = this;\n}",
"click" : "function (_self, e)\n{\n _this.dialog.hide();\n \n return;\n}"
},
"String weight" : "default",
"xtype" : "Button",
"$ xns" : "Roo.bootstrap",
"String html" : "Cancel",
"* prop" : "buttons[]"
},
{
"listeners" : {
"click" : "function (_self, e)\n{\n _this.form.doAction('submit');\n}"
},
"String weight" : "primary",
"xtype" : "Button",
"$ xns" : "Roo.bootstrap",
"String html" : "Confirm",
"* prop" : "buttons[]"
},
{
"listeners" : {
"render" : "function (_self)\n{\n _this.desktopView = this;\n}"
},
"xtype" : "Row",
"$ xns" : "Roo.bootstrap",
"items" : [
{
"xtype" : "Column",
"Number xs" : 12,
"$ xns" : "Roo.bootstrap",
"items" : [
{
"xtype" : "Row",
"$ xns" : "Roo.bootstrap",
"items" : [
{
"xtype" : "Column",
"Number xs" : 12,
"$ xns" : "Roo.bootstrap",
"items" : [
{
"xtype" : "Container",
"$ xns" : "Roo.bootstrap",
"String well" : "sm",
"String html" : "1. Open Authenticator App in your phone, and scan this QR code."
}
]
}
]
},
{
"xtype" : "Row",
"$ xns" : "Roo.bootstrap",
"items" : [
{
"String cls" : "text-center",
"xtype" : "Column",
"Number xs" : 12,
"$ xns" : "Roo.bootstrap",
"items" : [
{
"listeners" : {
"render" : "function (_self)\n{\n _this.qrcode_image = this;\n \n this.el.setVisibilityMode(Roo.Element.DISPLAY);\n \n}"
},
"Boolean imgResponsive" : false,
"String cls" : "qr-code",
"xtype" : "Img",
"String src" : "about:blank",
"$ xns" : "Roo.bootstrap"
}
]
}
]
},
{
"xtype" : "Row",
"$ xns" : "Roo.bootstrap",
"items" : [
{
"xtype" : "Column",
"Number xs" : 12,
"$ xns" : "Roo.bootstrap",
"items" : [
{
"xtype" : "Container",
"$ xns" : "Roo.bootstrap",
"String well" : "sm",
"String html" : "2. After adding this to Authenticator app, type in the generated number below to confirm."
}
]
}
]
}
]
}
]
},
{
"listeners" : {
"render" : "function (_self)\n{\n _this.mobileView = this;\n}"
},
"xtype" : "Row",
"$ xns" : "Roo.bootstrap",
"items" : [
{
"xtype" : "Column",
"Number xs" : 12,
"$ xns" : "Roo.bootstrap",
"items" : [
{
"xtype" : "Row",
"$ xns" : "Roo.bootstrap",
"items" : [
{
"xtype" : "Column",
"Number xs" : 12,
"$ xns" : "Roo.bootstrap",
"items" : [
{
"listeners" : {
"render" : "function (_self)\n{\n this.el.select('.download-google-authenticator', true).first().on('click', function(e){\n e.preventDefault();\n \n if(Roo.isIOS) {\n window.open(\"https://itunes.apple.com/us/app/google-authenticator/id388497605?mt=8\", \"_blank\");\n return;\n }\n \n window.open(\"https://play.google.com/store/apps/details?id=com.google.android.apps.authenticator2\", \"_blank\");\n });\n \n this.el.select('.download-authy', true).first().on('click', function(e){\n e.preventDefault();\n \n if(Roo.isIOS) {\n window.open(\"https://itunes.apple.com/us/app/authy/id494168017?mt=8\", \"_blank\");\n return;\n }\n \n window.open(\"https://play.google.com/store/apps/details?id=com.ionicpremium.authy\", \"_blank\");\n });\n}"
},
"xtype" : "Container",
"$ xns" : "Roo.bootstrap",
"String well" : "sm",
"String html" : "1. Download an Authentication App on your phone, like \"Google Authenticator\" or \"Authy\" "
}
]
}
]
},
{
"xtype" : "Row",
"$ xns" : "Roo.bootstrap",
"items" : [
{
"xtype" : "Column",
"Number xs" : 12,
"$ xns" : "Roo.bootstrap",
"items" : [
{
"xtype" : "Container",
"$ xns" : "Roo.bootstrap",
"String well" : "sm",
"String html" : "2. In the App, select \"Create or Setup an Account\""
}
]
}
]
},
{
"xtype" : "Row",
"$ xns" : "Roo.bootstrap",
"items" : [
{
"xtype" : "Column",
"Number xs" : 12,
"$ xns" : "Roo.bootstrap",
"items" : [
{
"listeners" : {
"render" : "function (_self)\n{\n _this.issuer_notify = this;\n}"
},
"xtype" : "Container",
"string _html" : "3. For the Account Name user \"{0}\"",
"$ xns" : "Roo.bootstrap",
"String well" : "sm",
"String html" : "3. For the Account Name user \"{0}\""
}
]
}
]
},
{
"xtype" : "Row",
"$ xns" : "Roo.bootstrap",
"items" : [
{
"xtype" : "Column",
"Number xs" : 12,
"$ xns" : "Roo.bootstrap",
"items" : [
{
"xtype" : "Container",
"$ xns" : "Roo.bootstrap",
"String well" : "sm",
"String html" : "4. Enter the code below as \"Your Key\""
}
]
}
]
},
{
"xtype" : "Row",
"$ xns" : "Roo.bootstrap",
"items" : [
{
"xtype" : "Column",
"Number xs" : 12,
"$ xns" : "Roo.bootstrap",
"items" : [
{
"listeners" : {
"render" : "function (_self)\n{\n _this.secret = this;\n}"
},
"String name" : "secret",
"Boolean readOnly" : true,
"xtype" : "Input",
"$ xns" : "Roo.bootstrap"
}
]
},
{
"String cls" : "text-center",
"xtype" : "Column",
"Number xs" : 12,
"$ xns" : "Roo.bootstrap",
"items" : [
{
"listeners" : {
"click" : "function (_self, e)\n{\n var el = _this.secret.inputEl().dom;\n \n\tif (document.body.createTextRange) {\n\t // IE\n var textRange = document.body.createTextRange();\n textRange.moveToElementText(el);\n textRange.select();\n textRange.execCommand(\"Copy\");\n } else if (window.getSelection && document.createRange) {\n // Non-IE\n var editable = el.contentEditable; // Record contentEditable status of element\n var readOnly = el.readOnly; // Record readOnly status of element\n \tel.contentEditable = true; // iOS will only select text on non-form elements if contentEditable = true;\n \tel.readOnly = false; // iOS will not select in a read only form element\n var range = document.createRange();\n range.selectNodeContents(el);\n var sel = window.getSelection();\n sel.removeAllRanges();\n sel.addRange(range); // Does not work for Firefox if a textarea or input\n \n if (el.nodeName == \"TEXTAREA\" || el.nodeName == \"INPUT\") {\n el.select(); // Firefox will only select a form element with select()\n }\n \t\n if (el.setSelectionRange && navigator.userAgent.match(/ipad|ipod|iphone/i)) {\n el.setSelectionRange(0, 999999); // iOS only selects \"form\" elements with SelectionRange\n }\n \t\n el.contentEditable = editable; // Restore previous contentEditable status\n el.readOnly = readOnly; // Restore previous readOnly status \n \n document.execCommand('copy');\n }\n}"
},
"String size" : "sm",
"Boolean preventDefault" : true,
"xtype" : "Button",
"$ xns" : "Roo.bootstrap",
"String html" : "Copy Key",
"String style" : "margin-bottom: 15px;"
}
]
}
]
},
{
"xtype" : "Row",
"$ xns" : "Roo.bootstrap",
"items" : [
{
"xtype" : "Column",
"Number xs" : 12,
"$ xns" : "Roo.bootstrap",
"items" : [
{
"xtype" : "Container",
"$ xns" : "Roo.bootstrap",
"String well" : "sm",
"String html" : "5. After adding this to Authenticator app, type in the generated number below to confirm."
}
]
}
]
}
]
}
]
},
{
"xtype" : "Row",
"$ xns" : "Roo.bootstrap",
"items" : [
{
"xtype" : "Column",
"Number xs" : 12,
"$ xns" : "Roo.bootstrap",
"items" : [
{
"listeners" : {
"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}",
"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 \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}",
"render" : "function (_self)\n{\n _this.form = this;\n}"
},
"xtype" : "Form",
"$ xns" : "Roo.bootstrap",
"String method" : "GET",
"$ String url" : "baseURL + '/Roo/Core_person.php'",
"items" : [
{
"Boolean allowBlank" : false,
"Number maxLength" : 6,
"Boolean allowZero" : false,
"String name" : "two_factor_auth_code",
"Boolean allowDecimals" : false,
"xtype" : "NumberField",
"string fieldLabel" : "Enter Two factor Authentication code",
"String labelAlign" : "top",
"Number xs" : 12,
"Number decimalPrecision" : 0,
"$ xns" : "Roo.bootstrap",
"Boolean allowNegative" : false,
"String indicatorpos" : "right"
},
{
"String name" : "id",
"xtype" : "Input",
"String inputType" : "hidden",
"$ xns" : "Roo.bootstrap"
}
]
}
]
}
]
}
]
}
]
}