mirror of
https://github.com/moodle/moodle.git
synced 2025-04-20 16:04:25 +02:00
MDL-56159 webservice: Tolerate exceptions in the get_autologin_key ws
This commit is contained in:
parent
80e0f0b85b
commit
43d8e805bb
@ -240,7 +240,22 @@ class external extends external_api {
|
||||
$privatetoken = $params['privatetoken'];
|
||||
|
||||
$context = context_system::instance();
|
||||
self::validate_context($context);
|
||||
|
||||
// We must toletare these two exceptions: forcepasswordchangenotice and usernotfullysetup.
|
||||
try {
|
||||
self::validate_context($context);
|
||||
} catch (Exception $e) {
|
||||
if ($e instanceof moodle_exception) {
|
||||
if (($e->errorcode != 'usernotfullysetup') and
|
||||
($e->errorcode != 'forcepasswordchangenotice')) {
|
||||
|
||||
// In case we receive a different exception, throw it.
|
||||
throw $e;
|
||||
}
|
||||
} else {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
api::check_autologin_prerequisites($USER->id);
|
||||
|
||||
@ -293,4 +308,4 @@ class external extends external_api {
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user