FBI-2293:Workspace> You can create a new ws with different password

Documentation
This commit is contained in:
Fabio Guachalla
2018-01-19 12:44:16 -04:00
committed by Rodrigo Quelca
parent 659bffc95a
commit 71f4dcd0c1

View File

@@ -6,8 +6,10 @@
Ext.Ajax.timeout = 300000; Ext.Ajax.timeout = 300000;
Ext.onReady(function(){ Ext.onReady(function(){
var fieldNameWS,
wspaceAdmWS;
var fieldNameWS=new Ext.form.TextField({ fieldNameWS=new Ext.form.TextField({
id: 'NW_TITLE', id: 'NW_TITLE',
fieldLabel: _('ID_NAME'), fieldLabel: _('ID_NAME'),
xtype:'textfield', xtype:'textfield',
@@ -82,45 +84,64 @@ Ext.onReady(function(){
] ]
}); });
wspaceAdmWS = new Ext.form.FieldSet({ wspaceAdmWS = new Ext.form.FieldSet({
title: _('ID_WORKSPACE_ADMINISTRATOR'), title: _('ID_WORKSPACE_ADMINISTRATOR'),
items: [ items: [
{ {
id: 'NW_USERNAME', id: 'NW_USERNAME',
fieldLabel: _('ID_USERNAME'), fieldLabel: _('ID_USERNAME'),
xtype:'textfield', xtype: 'textfield',
value:'admin', value: 'admin',
width: 200, width: 200,
allowBlank: false allowBlank: false
}, },
{ {
id: 'NW_PASSWORD', id: 'NW_PASSWORD',
fieldLabel: _('ID_PASSWORD_ADMIN'), fieldLabel: _('ID_PASSWORD_ADMIN'),
xtype:'textfield', xtype: 'textfield',
inputType:'password', inputType: 'password',
value:'admin', value: 'admin',
width: 200, width: 200,
allowBlank: false, allowBlank: false,
validator: function (v) { validator: function (v) {
v = v.trim(); v = v.trim();
return !/^\s+$/.test(v); return !/^\s+$/.test(v);
} },
}, enableKeyEvents: true,
{ listeners: {
id: 'NW_PASSWORD2', keyup: function () {
fieldLabel: _('ID_PASSWORD_ADMIN_RETYPE'), validationPassword();
xtype:'textfield', }
inputType:'password', }
value:'admin', },
width: 200, {
allowBlank: false, id: 'NW_PASSWORD2',
validator: function (v) { fieldLabel: _('ID_PASSWORD_ADMIN_RETYPE'),
v = v.trim(); xtype: 'textfield',
return !/^\s+$/.test(v); inputType: 'password',
} value: 'admin',
} width: 200,
] allowBlank: false,
}); validator: function (v) {
v = v.trim();
return !/^\s+$/.test(v);
},
enableKeyEvents: true,
listeners: {
keyup: function () {
validationPassword();
}
}
},
{
xtype: 'label',
fieldLabel: ' ',
id:'passwordConfirm',
width: 200,
labelSeparator: ''
}
]
});
formNewSite = new Ext.FormPanel({ formNewSite = new Ext.FormPanel({
@@ -167,40 +188,49 @@ Ext.onReady(function(){
formNewSite.getForm().reset(); formNewSite.getForm().reset();
Ext.getCmp('_idTest').enable(); Ext.getCmp('_idTest').enable();
} }
function TestSite(){
formNewSite.getForm().submit({ /**
url: '../newSiteProxy/testingNW', * Test for create new Site.
params: { * @constructor
action : 'test' */
}, function TestSite() {
waitMsg : _('ID_NEW_SITE_TESTING'), if (validationPassword()) {
waitTitle : " ", formNewSite.getForm().submit({
success: function(f,a){ url: '../newSiteProxy/testingNW',
nwTitle =formNewSite.getForm().findField('NW_TITLE').getValue(); params: {
aoDbWf =formNewSite.getForm().findField('AO_DB_WF').getValue(); action: 'test'
aoDbRb =aoDbWf; },
aoDbRp =aoDbWf; waitMsg: _('ID_NEW_SITE_TESTING'),
nwUsername =formNewSite.getForm().findField('NW_USERNAME').getValue(); waitTitle: " ",
nwPassword = formNewSite.getForm().findField('NW_PASSWORD').getValue().trim(); success: function (f, a) {
nwPassword2 = formNewSite.getForm().findField('NW_PASSWORD2').getValue().trim(); nwTitle = formNewSite.getForm().findField('NW_TITLE').getValue();
aoDbDrop=formNewSite.getForm().findField('AO_DB_DROP').getValue(); aoDbWf = formNewSite.getForm().findField('AO_DB_WF').getValue();
createNW(nwTitle, aoDbWf, aoDbRb, aoDbRp, nwUsername, nwPassword, nwPassword2); aoDbRb = aoDbWf;
}, aoDbRp = aoDbWf;
failure: function(f,a){ nwUsername = formNewSite.getForm().findField('NW_USERNAME').getValue();
if (a.failureType === Ext.form.Action.CONNECT_FAILURE){ nwPassword = formNewSite.getForm().findField('NW_PASSWORD').getValue().trim();
Ext.Msg.alert(_('ID_FAILURE'), _('ID_SERVER_REPORTED') + ':' + a.response.status+' '+a.response.statusText); nwPassword2 = formNewSite.getForm().findField('NW_PASSWORD2').getValue().trim();
} aoDbDrop = formNewSite.getForm().findField('AO_DB_DROP').getValue();
if (a.failureType === Ext.form.Action.SERVER_INVALID){ createNW(nwTitle, aoDbWf, aoDbRb, aoDbRp, nwUsername, nwPassword, nwPassword2);
var text = JSON.parse(a.response.responseText); },
if (typeof(text.message) != 'undefined') { failure: function (f, a) {
Ext.Msg.alert(_('ID_ERROR'), _('ID_MYSQL_ERROR', text.message)); if (a.failureType === Ext.form.Action.CONNECT_FAILURE) {
} else { Ext.Msg.alert(_('ID_FAILURE'), _('ID_SERVER_REPORTED') + ':' + a.response.status + ' ' + a.response.statusText);
Ext.Msg.alert(_('ID_WARNING'), _('NEW_SITE_NOT_AVAILABLE')); }
} if (a.failureType === Ext.form.Action.SERVER_INVALID) {
} var text = JSON.parse(a.response.responseText);
} if (typeof(text.message) !== 'undefined') {
}); Ext.Msg.alert(_('ID_ERROR'), _('ID_MYSQL_ERROR', text.message));
} } else {
Ext.Msg.alert(_('ID_WARNING'), _('NEW_SITE_NOT_AVAILABLE'));
}
}
}
});
} else {
Ext.Msg.alert( _('ID_ERROR'), _('ID_PASSWORDS_DONT_MATCH'));
}
}
function createNW(nwTitle, aoDbWf, aoDbRb, aoDbRp, nwUsername, nwPassword, nwPassword2){ function createNW(nwTitle, aoDbWf, aoDbRb, aoDbRp, nwUsername, nwPassword, nwPassword2){
PMExt.confirm(_('ID_CONFIRM'), _('NEW_SITE_CONFIRM_TO_CREATE'), function(){ PMExt.confirm(_('ID_CONFIRM'), _('NEW_SITE_CONFIRM_TO_CREATE'), function(){
@@ -246,3 +276,25 @@ Ext.onReady(function(){
}); });
}); });
} }
/**
* Validation if the field password and the field re-write password are similar.
* @returns {boolean}
*/
function validationPassword () {
var spanErrorConfirm,
imageErrorConfirm,
labelErrorConfirm;
if (Ext.getCmp('NW_PASSWORD').getValue() !== Ext.getCmp('NW_PASSWORD2').getValue()) {
spanErrorConfirm = '<span style="color: red; font: 9px tahoma,arial,helvetica,sans-serif;">';
imageErrorConfirm = '<img width="13" height="13" border="0" src="/images/delete.png">';
labelErrorConfirm = _('ID_PASSWORDS_DONT_MATCH');
Ext.getCmp('passwordConfirm').setText(spanErrorConfirm + imageErrorConfirm + labelErrorConfirm + '</span>', false);
Ext.getCmp('passwordConfirm').setVisible(true);
return false;
} else {
Ext.getCmp('passwordConfirm').setVisible(false);
return true;
}
}