mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 00:16:46 +02:00
webservice MDL-21351 token error message more explicit
This commit is contained in:
parent
cedc5b828a
commit
3785c9e221
2 changed files with 8 additions and 4 deletions
|
@ -157,15 +157,15 @@ abstract class webservice_server implements webservice_server_interface {
|
|||
} else {
|
||||
if (!$token = $DB->get_record('external_tokens', array('token'=>$this->token, 'tokentype'=>EXTERNAL_TOKEN_PERMANENT))) {
|
||||
// TODO: MDL-12886 log failed login attempts
|
||||
throw new webservice_access_exception('Invalid token');
|
||||
throw new webservice_access_exception(get_string('invalidtoken', 'webservice'));
|
||||
}
|
||||
|
||||
if ($token->validuntil and $token->validuntil < time()) {
|
||||
throw new webservice_access_exception('Invalid token');
|
||||
throw new webservice_access_exception(get_string('invalidtimedtoken', 'webservice'));
|
||||
}
|
||||
|
||||
if ($token->iprestriction and !address_in_subnet(getremoteaddr(), $token->iprestriction)) {
|
||||
throw new webservice_access_exception('Invalid token');
|
||||
throw new webservice_access_exception(get_string('invalidiptoken', 'webservice'));
|
||||
}
|
||||
|
||||
$this->restricted_context = get_context_instance_by_id($token->contextid);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue