- Correction bug [#1666] Message d'erreur lors d'une requête Ajax lorsque

l'utilisateur n'est pas (ou plus) authentifié.
This commit is contained in:
Benjamin Renard 2008-05-14 09:05:06 +00:00
parent 9b0fb18008
commit 3eeb385d90
2 changed files with 243 additions and 238 deletions

View file

@ -83,7 +83,7 @@ var LSform = new Class({
LSdebug(data); LSdebug(data);
if ( data ) { if ( data ) {
if ( typeof(data.LSerror) != "undefined" ) { if ( typeof(data.LSerror) != "undefined" ) {
varLSdefault.loadingImgHide(); varLSdefault.loadingImgHide(data.imgload);
varLSdefault.displayError(data.LSerror); varLSdefault.displayError(data.LSerror);
return; return;
} }
@ -198,7 +198,7 @@ var LSform = new Class({
var data = Json.evaluate(responseText); var data = Json.evaluate(responseText);
if ( data ) { if ( data ) {
if ( typeof(data.LSerror) != "undefined" ) { if ( typeof(data.LSerror) != "undefined" ) {
varLSdefault.loadingImgHide(); varLSdefault.loadingImgHide(data.imgload);
varLSdefault.displayError(data.LSerror); varLSdefault.displayError(data.LSerror);
return; return;
} }
@ -236,7 +236,7 @@ var LSform = new Class({
var data = Json.evaluate(responseText); var data = Json.evaluate(responseText);
if ( data ) { if ( data ) {
if ( typeof(data.LSerror) != "undefined" ) { if ( typeof(data.LSerror) != "undefined" ) {
varLSdefault.loadingImgHide(); varLSdefault.loadingImgHide(data.imgload);
varLSdefault.displayError(data.LSerror); varLSdefault.displayError(data.LSerror);
return; return;
} }

View file

@ -7,11 +7,12 @@ $GLOBALS['LSsession'] = new LSsession();
if ($_REQUEST['template'] != 'login') { if ($_REQUEST['template'] != 'login') {
if ( !$GLOBALS['LSsession'] -> startLSsession() ) { if ( !$GLOBALS['LSsession'] -> startLSsession() ) {
echo json_encode(array('LSerror' => 'LSsession : Impossible d\'initialiser la LSsession.' )); $_ERRORS = 'LSsession : Impossible d\'initialiser la LSsession.';
} }
} }
$data=NULL; $data=NULL;
switch($_REQUEST['template']) { if (!isset($_ERRORS)) {
switch($_REQUEST['template']) {
case 'login': case 'login':
switch($_REQUEST['action']) { switch($_REQUEST['action']) {
case 'onLdapServerChanged': case 'onLdapServerChanged':
@ -305,11 +306,15 @@ switch($_REQUEST['template']) {
break; break;
} }
break; break;
}
} }
if ($GLOBALS['LSerror']->errorsDefined()) { if ($GLOBALS['LSerror']->errorsDefined()) {
$data['LSerror'] = $GLOBALS['LSerror']->getErrors(); $data['LSerror'] = $GLOBALS['LSerror']->getErrors();
} }
else if (isset($_ERRORS)) {
$data['LSerror'] = $_ERRORS;
}
if (isset($_REQUEST['imgload'])) { if (isset($_REQUEST['imgload'])) {
$data['imgload'] = $_REQUEST['imgload']; $data['imgload'] = $_REQUEST['imgload'];