{ "name" : "Pman.Dialog.BAdminStaff", "parent" : "", "title" : "", "path" : "/home/alan/gitlive/Pman.BAdmin/Pman.Dialog.BAdminStaff.bjs", "permname" : "", "modOrder" : "001", "strings" : { "ce8ae9da5b7cd6c3df2929543a9af92d" : "Email", "bcc254b55c4a1babdf1dcb82c207506b" : "Phone", "a0f852ef8bfccd86a0e7217d7959e3e8" : "Add / Edit User", "0bfe42db3eb05bf39f03812166391939" : "Use Secure Passwords", "ea4788705e6873b424c65e91c2846b19" : "Cancel", "6f958ddaf50fd5ade7858ef1d1a63e51" : "Type again to confirm", "bbbabdbe1b262f75d99d62880b953be1" : "Role", "49ee3087348e8d44e1feda1917443987" : "Name", "c9cc8cce247e49bae79f15173ce97354" : "Save", "828e70f83623b262e14187c039df99c0" : "Enable Two-Factor Authentication", "acf45fd8829f809b29c601a3a193804f" : "Set / Change Password", "01028205a11cf95a503c4c1d005989da" : "Generate One" }, "named_strings" : { "email_placeholder" : "ce8ae9da5b7cd6c3df2929543a9af92d", "secure_passwords_boxLabel" : "0bfe42db3eb05bf39f03812166391939", "name_placeholder" : "49ee3087348e8d44e1feda1917443987", "role_fieldLabel" : "bbbabdbe1b262f75d99d62880b953be1", "name_fieldLabel" : "49ee3087348e8d44e1feda1917443987", "role_placeholder" : "bbbabdbe1b262f75d99d62880b953be1", "phone_fieldLabel" : "bcc254b55c4a1babdf1dcb82c207506b", "_enable_oath_key_boxLabel" : "828e70f83623b262e14187c039df99c0", "email_fieldLabel" : "ce8ae9da5b7cd6c3df2929543a9af92d", "passwd2_placeholder" : "6f958ddaf50fd5ade7858ef1d1a63e51" }, "items" : [ { "listeners" : { "render" : "function (_self)\n{\n _this.dialog = this;\n}" }, "String cls" : "add-user-dialog", "string fit_content" : true, "xtype" : "Modal", "$ xns" : "Roo.bootstrap", "String title" : "Add / Edit User", "items" : [ { "listeners" : { "actioncomplete" : "function (_self, action)\n{\n if(action.type == 'setdata'){\n \n // _this.layout.showPanel('DetailPanel');\n \n _this.dialog.setTitle(_this.data.id *1 > 0 ? \"Edit User: \" + _this.data.name : 'Add User');\n _this.form.findField('role').setDisabled(false);\n \n /*\n * Use for init -- Call from Pman.Login.js\n */\n if(\n typeof(_this.data.role) != 'undefined' &&\n _this.data.role == 'Administrators'\n ) {\n _this.dialog.setTitle(\"Create Adminstrator\");\n _this.form.findField('role').setDisabled(true);\n }\n \n _this.form.findField('passwd1').el.select('input',true).first().dom.type=\"password\";\n _this.form.findField('passwd2').show();\n _this.passwordbox.collapse();\n \n _this.form.findField('secure_passwords').setValue(1);\n \n if(_this.data.id * 1 > 0) {\n this.doAction('load',{ method: 'GET', params: { '_id' : _this.data.id }});\n }\n \n \n \n this.clearInvalid();\n \n _this.dialog.resize();\n \n return;\n }\n \n if (action.type == 'load') {\n \n _this.data = action.result.data;\n \n // oath handling...\n \n _this.form.findField('_enable_oath_key').setChecked(false,false);\n \n if(_this.data.length_oath_key != '0') {\n _this.form.findField('_enable_oath_key').setChecked(true,false);\n }\n \n return;\n }\n \n if (action.type == 'submit') { // only submitted here if we are \n \n _this.dialog.hide();\n \n if (_this.callback) {\n _this.callback.call(this, action.result.data);\n }\n \n return;\n }\n}", "render" : "function (_self)\n{\n _this.form = this;\n}" }, "$ url" : "baseURL + '/Roo/core_person' ", "style" : "margin-top: 20px;", "xtype" : "Form", "String labelAlign" : "top", "$ xns" : "Roo.bootstrap", "string errorMask" : true, "items" : [ { "xtype" : "Row", "$ xns" : "Roo.bootstrap", "items" : [ { "Number md" : 12, "xtype" : "Column", "$ xns" : "Roo.bootstrap", "items" : [ { "Boolean allowBlank" : false, "String name" : "name", "xtype" : "Input", "string placeholder" : "Name", "String labelAlign" : "left", "string fieldLabel" : "Name", "$ xns" : "Roo.bootstrap" } ] } ] }, { "xtype" : "Row", "$ xns" : "Roo.bootstrap", "items" : [ { "Number md" : 12, "xtype" : "Column", "$ xns" : "Roo.bootstrap", "items" : [ { "String name" : "role", "xtype" : "Input", "string placeholder" : "Role", "string fieldLabel" : "Role", "String labelAlign" : "left", "$ xns" : "Roo.bootstrap" } ] } ] }, { "xtype" : "Row", "$ xns" : "Roo.bootstrap", "items" : [ { "Number md" : 12, "xtype" : "Column", "$ xns" : "Roo.bootstrap", "items" : [ { "Boolean allowBlank" : false, "String name" : "email", "xtype" : "Input", "vtype" : "email", "string placeholder" : "Email", "String labelAlign" : "left", "string fieldLabel" : "Email", "$ xns" : "Roo.bootstrap" } ] } ] }, { "xtype" : "Row", "$ xns" : "Roo.bootstrap", "items" : [ { "Number md" : 12, "xtype" : "Column", "$ xns" : "Roo.bootstrap", "items" : [ { "String name" : "phone", "xtype" : "Input", "string fieldLabel" : "Phone", "String labelAlign" : "left", "$ xns" : "Roo.bootstrap" } ] } ] }, { "xtype" : "Row", "$ xns" : "Roo.bootstrap", "items" : [ { "Number md" : 12, "xtype" : "Column", "$ xns" : "Roo.bootstrap", "items" : [ { "listeners" : { "click" : "function (_self, e)\n{\n if(!Pman.Login.authUser) {\n Roo.bootstrap.MessageBox.alert('Error', 'Please login again');\n return;\n }\n \n e.preventDefault();\n \n if(!this.checked) {\n \n Pman.Dialog.BAdminStaffTwoFactorQRCode.show({\n id: _this.data.id,\n allow_close: false,\n allow_cancel : true\n }, function(valid){\n if(valid) {\n _this.dialog.hide({});\n return;\n }\n \n _this.form.findField('_enable_oath_key').setChecked(false,false);\n }\n );\n \n return;\n }\n \n new Pman.Request({\n url : baseURL + '/Roo/Core_person',\n method :'GET',\n params : {\n oath_key_disable: 1,\n id: _this.data.id\n },\n success : function(res)\n {\n switch(res.data) {\n case 'DONE':\n Roo.bootstrap.MessageBox.alert('Success', 'The two factor authentication has been disabled');\n break;\n default:\n Roo.log('invalid usage');\n break;\n }\n },\n failure : function(res)\n {\n Roo.bootstrap.MessageBox.alert('Error', res);\n }\n });\n}", "check" : "function (_self, checked)\n{\n if(checked) {\n \n this.setBoxLabel('Untick to disable Two Factor authentication');\n \n return;\n }\n \n this.setBoxLabel('Enable Two Factor Authentication');\n}" }, "String name" : "_enable_oath_key", "xtype" : "CheckBox", "String boxLabel" : "Enable Two-Factor Authentication", "$ xns" : "Roo.bootstrap" } ] } ] }, { "xtype" : "Row", "$ xns" : "Roo.bootstrap", "items" : [ { "Number md" : 12, "xtype" : "Column", "$ xns" : "Roo.bootstrap", "items" : [ { "listeners" : { "render" : "function (_self)\n{\n _this.passwordbox = this;\n}" }, "String header" : "Set / Change Password", "Boolean expanded" : false, "xtype" : "Container", "String panel" : "primary", "$ xns" : "Roo.bootstrap", "Boolean expandable" : true, "items" : [ { "xtype" : "Row", "$ xns" : "Roo.bootstrap", "items" : [ { "xtype" : "Column", "Number xs" : 8, "$ xns" : "Roo.bootstrap", "items" : [ { "String name" : "passwd1", "xtype" : "Input", "String inputType" : "password", "$ xns" : "Roo.bootstrap" } ] }, { "xtype" : "Column", "Number xs" : 4, "$ xns" : "Roo.bootstrap", "items" : [ { "listeners" : { "click" : "function (_self, e)\n{\n var pw = Math.random().toString(36).replace('0.', '');\n _this.form.findField('passwd1').el.select('input',true).first().dom.type=\"input\";\n _this.form.findField('passwd1').setValue(pw);\n _this.form.findField('passwd2').hide();\n}" }, "xtype" : "Button", "$ xns" : "Roo.bootstrap", "String html" : "Generate One", "String style" : "width:100%" } ] } ] }, { "String name" : "passwd2", "xtype" : "Input", "string placeholder" : "Type again to confirm", "String inputType" : "password", "$ xns" : "Roo.bootstrap" }, { "String name" : "secure_passwords", "xtype" : "CheckBox", "String boxLabel" : "Use Secure Passwords", "$ xns" : "Roo.bootstrap" } ] } ] } ] }, { "listeners" : { "render" : "function (_self)\n{\n _this.userID = _self;\n}" }, "String name" : "id", "xtype" : "Input", "String labelAlign" : "left", "String inputType" : "hidden", "$ xns" : "Roo.bootstrap" }, { "String name" : "company_id", "xtype" : "Input", "String inputType" : "hidden", "$ xns" : "Roo.bootstrap" } ] }, { "listeners" : { "click" : "function (_self, e)\n{\n _this.dialog.hide(); \n}" }, "xtype" : "Button", "$ xns" : "Roo.bootstrap", "String html" : "Cancel", "* prop" : "buttons[]" }, { "listeners" : { "click" : "function (_self, e)\n{\n if(!_this.form.isValid()){\n //Roo.bootstrap.MessageBox.alert('Error', 'Please Correct all the errors in red');\n return;\n }\n \n var myID = _this.form.findField('id').getValue() * 1;\n var myName = _this.form.findField('name').getValue();\n\n if (_this.form.findField('company_id') && !_this.form.findField('company_id').getValue()) {\n Roo.bootstrap.MessageBox.alert(\"Error\", \"Select a Company\");\n return;\n }\n \n // validate password match (only needed if we are not using generated one..\n if (_this.form.findField('passwd1') \n && _this.form.findField('passwd1').getValue().length > 0 \n && _this.form.findField('passwd1').inputEl().dom.type == \"password\") {\n \n var p1 = _this.form.findField('passwd1').getValue();\n var p2 = _this.form.findField('passwd2').getValue();\n \n \n if (Pman.Login.authUser.id < 0 && !p1.length) {\n Roo.bootstrap.MessageBox.alert(\"Error\", \"You must create a password for the admin account\");\n return;\n }\n \n \n if (p1.length || p2.length) {\n if (p1 != p2) {\n Roo.bootstrap.MessageBox.alert(\"Error\", \"Passwords do not match\");\n return;\n }\n }\n \n \n }\n \n // get the list of record with tick\n \n _this.form.doAction(\"submit\");\n \n return;\n\n}" }, "String weight" : "primary", "xtype" : "Button", "$ xns" : "Roo.bootstrap", "String html" : "Save", "* prop" : "buttons[]" } ] } ] }