Commit d5e0657e authored by Nigel McNie's avatar Nigel McNie

Better handling when the user is logged out and they try a json request. Ajax...

Better handling when the user is logged out and they try a json request. Ajax login is lying around somewhere, must integrate that some time.
parent 931154d0
......@@ -348,7 +348,7 @@ function auth_setup () {
$USER->logout();
if (defined('JSON')) {
json_reply('global', '', 1);
json_reply('global', get_string('sessiontimedoutreload'), 1);
}
// If the page the user is viewing is public, inform them that they can
......@@ -378,6 +378,11 @@ function auth_setup () {
if (defined('PUBLIC') && !isset($_GET['login'])) {
return;
}
// No session and a json request
if (defined('JSON')) {
json_reply('global', get_string('nosessionreload'), 1);
}
auth_draw_login_page(null, $form);
exit;
......
......@@ -26,8 +26,10 @@ function get_themeurl(s) {
}
function globalErrorHandler(data) {
if (data.returnCode == 3) {
if (data.returnCode == 1) {
// Logged out!
// Later - ajaxlogin
displayMessage(data.message, 'error');
}
else {
displayMessage(data.message, 'error');
......
......@@ -140,6 +140,7 @@ $string['login'] = 'Login';
$string['loginfailed'] = 'You have not provided the correct credentials to log in. Please check your username and password are correct.';
$string['loginto'] = 'Log in to %s';
$string['newpassword'] = 'New Password';
$string['nosessionreload'] = 'Reload the page to log in';
$string['oldpassword'] = 'Current Password';
$string['password'] = 'Password';
$string['passworddescription'] = ' ';
......@@ -151,6 +152,7 @@ $string['passwordtooeasy'] = 'Your password is too easy! Please choose a harder
$string['register'] = 'Register';
$string['sessiontimedout'] = 'Your session has timed out, please enter your login details to continue';
$string['sessiontimedoutpublic'] = 'Your session has timed out. You may <a href="?login">log in</a> to continue browsing';
$string['sessiontimedoutreload'] = 'Your session has timed out. Reload the page to log in again';
$string['username'] = 'Username';
$string['preferredname'] = 'Preferred Name';
$string['usernamedescription'] = ' ';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment