Skip to content

Commit

Permalink
Fixed issue #08477: a clear error message is now displayed when a ses…
Browse files Browse the repository at this point in the history
…sion expires
  • Loading branch information
Grapsus committed Jan 16, 2014
1 parent 6bab890 commit 22b0ced
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions application/controllers/survey/index.php
Expand Up @@ -143,18 +143,18 @@ function action()
// recompute $redata since $saved_id used to be a global
$redata = compact(array_keys(get_defined_vars()));


/*if ( $this->_didSessionTimeOut() )
{
// @TODO is this still required ?
$asMessage = array(
$clang->gT("Error"),
$clang->gT("We are sorry but your session has expired."),
$clang->gT("Either you have been inactive for too long, you have cookies disabled for your browser, or there were problems with your connection."),
sprintf($clang->gT("Please contact %s ( %s ) for further assistance."),$thissurvey['adminname'],$thissurvey['adminemail'])
);
$this->_niceExit($redata, __LINE__, null, $asMessage);
};*/
// set up a script that redirects the user to an error page when his session expires
Yii::app()->clientScript->registerScript('sessionexpires', "setTimeout(function(){location.href='?sessionExpired=yes'}, ".(Yii::app()->getConfig('iSessionExpirationTime')*1000).")", CClientScript::POS_READY);

This comment has been minimized.

Copy link
@Shnoulle

Shnoulle Jan 16, 2014

Collaborator

Hi,

I think this mus be a template system.
LS core give url : (see token mismatch), template can do the SetTimeOut / redirect .

No ?

if (Yii::app()->request->getQuery('sessionExpired') === 'yes')
{
$asMessage = array(
$clang->gT("Error"),
$clang->gT("We are sorry but your session has expired."),
$clang->gT("Either you have been inactive for too long, you have cookies disabled for your browser, or there were problems with your connection."),
sprintf($clang->gT("Please contact %s ( %s ) for further assistance."),$thissurvey['adminname'],$thissurvey['adminemail'])
);
$this->_niceExit($redata, __LINE__, null, $asMessage);
};

// Set the language of the survey, either from POST, GET parameter of session var
// Keep the old value, because SetSurveyLanguage update $_SESSION
Expand Down

1 comment on commit 22b0ced

@c-schmitz
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is not done the right way, either. It does not cover session timeouts created by the server - it uses only the configuration value which is bogus except for database sessions.

Please sign in to comment.