Commit d5e0657e authored by Nigel McNie's avatar Nigel McNie
Browse files

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 () { ...@@ -348,7 +348,7 @@ function auth_setup () {
$USER->logout(); $USER->logout();
if (defined('JSON')) { 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 // If the page the user is viewing is public, inform them that they can
...@@ -378,6 +378,11 @@ function auth_setup () { ...@@ -378,6 +378,11 @@ function auth_setup () {
if (defined('PUBLIC') && !isset($_GET['login'])) { if (defined('PUBLIC') && !isset($_GET['login'])) {
return; return;
} }
// No session and a json request
if (defined('JSON')) {
json_reply('global', get_string('nosessionreload'), 1);
}
auth_draw_login_page(null, $form); auth_draw_login_page(null, $form);
exit; exit;
......
...@@ -26,8 +26,10 @@ function get_themeurl(s) { ...@@ -26,8 +26,10 @@ function get_themeurl(s) {
} }
function globalErrorHandler(data) { function globalErrorHandler(data) {
if (data.returnCode == 3) { if (data.returnCode == 1) {
// Logged out! // Logged out!
// Later - ajaxlogin
displayMessage(data.message, 'error');
} }
else { else {
displayMessage(data.message, 'error'); displayMessage(data.message, 'error');
......
...@@ -140,6 +140,7 @@ $string['login'] = 'Login'; ...@@ -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['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['loginto'] = 'Log in to %s';
$string['newpassword'] = 'New Password'; $string['newpassword'] = 'New Password';
$string['nosessionreload'] = 'Reload the page to log in';
$string['oldpassword'] = 'Current Password'; $string['oldpassword'] = 'Current Password';
$string['password'] = 'Password'; $string['password'] = 'Password';
$string['passworddescription'] = ' '; $string['passworddescription'] = ' ';
...@@ -151,6 +152,7 @@ $string['passwordtooeasy'] = 'Your password is too easy! Please choose a harder ...@@ -151,6 +152,7 @@ $string['passwordtooeasy'] = 'Your password is too easy! Please choose a harder
$string['register'] = 'Register'; $string['register'] = 'Register';
$string['sessiontimedout'] = 'Your session has timed out, please enter your login details to continue'; $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['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['username'] = 'Username';
$string['preferredname'] = 'Preferred Name'; $string['preferredname'] = 'Preferred Name';
$string['usernamedescription'] = ' '; $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