Merge pull request #54 from brayanpereyra/BUG-8830
BUG 8830 The variables are camelize SOLVED
This commit is contained in:
@@ -511,5 +511,58 @@ switch($_POST['action'])
|
|||||||
}
|
}
|
||||||
print(G::json_encode($rowsCasesMenu));
|
print(G::json_encode($rowsCasesMenu));
|
||||||
break;
|
break;
|
||||||
|
case 'testPassword';
|
||||||
|
require_once 'classes/model/UsersProperties.php';
|
||||||
|
$oUserProperty = new UsersProperties();
|
||||||
|
|
||||||
|
$aFields = array();
|
||||||
|
$color = '';
|
||||||
|
$img = '';
|
||||||
|
$dateNow = date('Y-m-d H:i:s');
|
||||||
|
$aErrors = $oUserProperty->validatePassword($_POST['PASSWORD_TEXT'], $dateNow, $dateNow);
|
||||||
|
|
||||||
|
if (!empty($aErrors)) {
|
||||||
|
$img = '/images/delete.png';
|
||||||
|
$color = 'red';
|
||||||
|
if (!defined('NO_DISPLAY_USERNAME')) {
|
||||||
|
define('NO_DISPLAY_USERNAME', 1);
|
||||||
|
}
|
||||||
|
$aFields = array();
|
||||||
|
$aFields['DESCRIPTION'] = G::LoadTranslation('ID_POLICY_ALERT').':<br />';
|
||||||
|
|
||||||
|
foreach ($aErrors as $sError) {
|
||||||
|
switch ($sError) {
|
||||||
|
case 'ID_PPP_MINIMUM_LENGTH':
|
||||||
|
$aFields['DESCRIPTION'] .= ' - ' . G::LoadTranslation($sError).': ' . PPP_MINIMUM_LENGTH . '<br />';
|
||||||
|
$aFields[substr($sError, 3)] = PPP_MINIMUM_LENGTH;
|
||||||
|
break;
|
||||||
|
case 'ID_PPP_MAXIMUM_LENGTH':
|
||||||
|
$aFields['DESCRIPTION'] .= ' - ' . G::LoadTranslation($sError).': ' . PPP_MAXIMUM_LENGTH . '<br />';
|
||||||
|
$aFields[substr($sError, 3)] = PPP_MAXIMUM_LENGTH;
|
||||||
|
break;
|
||||||
|
case 'ID_PPP_EXPIRATION_IN':
|
||||||
|
$aFields['DESCRIPTION'] .= ' - ' . G::LoadTranslation($sError).' ' . PPP_EXPIRATION_IN . ' ' . G::LoadTranslation('ID_DAYS') . '<br />';
|
||||||
|
$aFields[substr($sError, 3)] = PPP_EXPIRATION_IN;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$aFields['DESCRIPTION'] .= ' - ' . G::LoadTranslation($sError).'<br />';
|
||||||
|
$aFields[substr($sError, 3)] = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$aFields['DESCRIPTION'] .= G::LoadTranslation('ID_PLEASE_CHANGE_PASSWORD_POLICY') . '</span>';
|
||||||
|
$aFields['STATUS'] = false;
|
||||||
|
} else {
|
||||||
|
$color = 'green';
|
||||||
|
$img = '/images/dialog-ok-apply.png';
|
||||||
|
$aFields['DESCRIPTION'] .= G::LoadTranslation('ID_PASSWORD_COMPLIES_POLICIES') . '</span>';
|
||||||
|
$aFields['STATUS'] = true;
|
||||||
|
}
|
||||||
|
$span = '<span style="color: ' . $color . '; font: 9px tahoma,arial,helvetica,sans-serif;">';
|
||||||
|
$gif = '<img width="13" height="13" border="0" src="' . $img . '">';
|
||||||
|
$aFields['DESCRIPTION'] = $span . $gif . $aFields['DESCRIPTION'];
|
||||||
|
print(G::json_encode($aFields));
|
||||||
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ var infoMode;
|
|||||||
var global = {};
|
var global = {};
|
||||||
var readMode;
|
var readMode;
|
||||||
var canEdit = true;
|
var canEdit = true;
|
||||||
|
var flagPoliciesPassword = false;
|
||||||
//var rendeToPage='document.body';
|
//var rendeToPage='document.body';
|
||||||
global.IC_UID = '';
|
global.IC_UID = '';
|
||||||
global.IS_UID = '';
|
global.IS_UID = '';
|
||||||
@@ -449,7 +450,63 @@ Ext.onReady(function() {
|
|||||||
xtype : 'textfield',
|
xtype : 'textfield',
|
||||||
inputType : 'password',
|
inputType : 'password',
|
||||||
width : 260,
|
width : 260,
|
||||||
allowBlank : allowBlackStatus
|
allowBlank : allowBlackStatus,
|
||||||
|
listeners: {
|
||||||
|
blur : function(ob)
|
||||||
|
{
|
||||||
|
var spanAjax = '<span style="font: 9px tahoma,arial,helvetica,sans-serif;">';
|
||||||
|
var imageAjax = '<img width="13" height="13" border="0" src="/images/ajax-loader.gif">';
|
||||||
|
var labelAjax = _('ID_PASSWORD_TESTING');
|
||||||
|
|
||||||
|
Ext.getCmp('passwordReview').setText(spanAjax + imageAjax + labelAjax + '</span>', false);
|
||||||
|
Ext.getCmp('passwordReview').setVisible(true);
|
||||||
|
|
||||||
|
var passwordText = this.getValue();
|
||||||
|
|
||||||
|
Ext.Ajax.request({
|
||||||
|
url : 'usersAjax',
|
||||||
|
method:'POST',
|
||||||
|
params : {
|
||||||
|
'action' : 'testPassword',
|
||||||
|
'PASSWORD_TEXT' : passwordText
|
||||||
|
},
|
||||||
|
success: function(r,o){
|
||||||
|
var resp = Ext.util.JSON.decode(r.responseText);
|
||||||
|
|
||||||
|
if (resp.STATUS) {
|
||||||
|
flagPoliciesPassword = true;
|
||||||
|
} else {
|
||||||
|
flagPoliciesPassword = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
Ext.getCmp('passwordReview').setText(resp.DESCRIPTION, false);
|
||||||
|
},
|
||||||
|
failure: function () {
|
||||||
|
Ext.MessageBox.show({
|
||||||
|
title: 'Error',
|
||||||
|
msg: 'Failed to store data',
|
||||||
|
buttons: Ext.MessageBox.OK,
|
||||||
|
animEl: 'mb9',
|
||||||
|
icon: Ext.MessageBox.ERROR
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Ext.getCmp('passwordReview').setVisible(true);
|
||||||
|
|
||||||
|
if (Ext.getCmp('USR_CNF_PASS').getValue() != '') {
|
||||||
|
userExecuteEvent(document.getElementById('USR_CNF_PASS'), 'blur');
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
xtype: 'label',
|
||||||
|
fieldLabel: ' ',
|
||||||
|
id:'passwordReview',
|
||||||
|
width: 300,
|
||||||
|
labelSeparator: ''
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id : 'USR_CNF_PASS',
|
id : 'USR_CNF_PASS',
|
||||||
@@ -457,7 +514,32 @@ Ext.onReady(function() {
|
|||||||
xtype : 'textfield',
|
xtype : 'textfield',
|
||||||
inputType : 'password',
|
inputType : 'password',
|
||||||
width : 260,
|
width : 260,
|
||||||
allowBlank : allowBlackStatus
|
allowBlank : allowBlackStatus,
|
||||||
|
listeners: {
|
||||||
|
blur : function(ob)
|
||||||
|
{
|
||||||
|
var passwordText = Ext.getCmp('USR_NEW_PASS').getValue();
|
||||||
|
var passwordConfirm = this.getValue();
|
||||||
|
|
||||||
|
if (passwordText != passwordConfirm) {
|
||||||
|
var spanErrorConfirm = '<span style="color: red; font: 9px tahoma,arial,helvetica,sans-serif;">';
|
||||||
|
var imageErrorConfirm = '<img width="13" height="13" border="0" src="/images/delete.png">';
|
||||||
|
var labelErrorConfirm = _('ID_NEW_PASS_SAME_OLD_PASS');
|
||||||
|
|
||||||
|
Ext.getCmp('passwordConfirm').setText(spanErrorConfirm + imageErrorConfirm + labelErrorConfirm + '</span>', false);
|
||||||
|
Ext.getCmp('passwordConfirm').setVisible(true);
|
||||||
|
} else {
|
||||||
|
Ext.getCmp('passwordConfirm').setVisible(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
xtype: 'label',
|
||||||
|
fieldLabel: ' ',
|
||||||
|
id:'passwordConfirm',
|
||||||
|
width: 300,
|
||||||
|
labelSeparator: ''
|
||||||
}
|
}
|
||||||
|
|
||||||
]
|
]
|
||||||
@@ -777,6 +859,14 @@ Ext.onReady(function() {
|
|||||||
frmDetails.render(document.body);
|
frmDetails.render(document.body);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Ext.getCmp('passwordReview').setVisible(false);
|
||||||
|
Ext.getCmp('passwordConfirm').setVisible(false);
|
||||||
|
|
||||||
|
var spanAjax = '<span style="font: 9px tahoma,arial,helvetica,sans-serif;">';
|
||||||
|
var imageAjax = '<img width="13" height="13" border="0" src="/images/ajax-loader.gif">';
|
||||||
|
var labelAjax = _('ID_PASSWORD_TESTING');
|
||||||
|
|
||||||
|
Ext.getCmp('passwordReview').setText(spanAjax + imageAjax + labelAjax + '</span>', false);
|
||||||
});
|
});
|
||||||
|
|
||||||
function defineUserPanel()
|
function defineUserPanel()
|
||||||
@@ -815,6 +905,10 @@ function editUser()
|
|||||||
}
|
}
|
||||||
function saveUser()
|
function saveUser()
|
||||||
{
|
{
|
||||||
|
if (flagPoliciesPassword != true) {
|
||||||
|
Ext.Msg.alert( _('ID_ERROR'), Ext.getCmp('passwordReview').html);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
var newPass = frmDetails.getForm().findField('USR_NEW_PASS').getValue();
|
var newPass = frmDetails.getForm().findField('USR_NEW_PASS').getValue();
|
||||||
var confPass = frmDetails.getForm().findField('USR_CNF_PASS').getValue();
|
var confPass = frmDetails.getForm().findField('USR_CNF_PASS').getValue();
|
||||||
@@ -1049,4 +1143,15 @@ function loadUserView()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function userExecuteEvent (element,event) {
|
||||||
|
if ( document.createEventObject ) {
|
||||||
|
// IE
|
||||||
|
var evt = document.createEventObject();
|
||||||
|
return element.fireEvent('on'+event,evt)
|
||||||
|
} else {
|
||||||
|
// firefox + others
|
||||||
|
var evt = document.createEvent("HTMLEvents");
|
||||||
|
evt.initEvent(event, true, true ); // event type,bubbling,cancelable
|
||||||
|
return !element.dispatchEvent(evt);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user