MDL-54551 core: AJAX call redirects to login page when session expired

This commit is contained in:
Thom Rawson
2018-07-18 18:07:16 +08:00
committed by Mark Nelson
parent 8c51626841
commit acf94de6d5
4 changed files with 19 additions and 7 deletions
+2 -2
View File
@@ -208,10 +208,10 @@ class external_api {
// Do not allow access to write or delete webservices as a public user.
if ($externalfunctioninfo->loginrequired) {
if (defined('NO_MOODLE_COOKIES') && NO_MOODLE_COOKIES && !PHPUNIT_TEST) {
throw new moodle_exception('servicenotavailable', 'webservice');
throw new moodle_exception('servicerequireslogin', 'webservice');
}
if (!isloggedin()) {
throw new moodle_exception('servicenotavailable', 'webservice');
throw new moodle_exception('servicerequireslogin', 'webservice');
} else {
require_sesskey();
}