MDL-66582 tool_mobile: Clean URLs from auth plugins

In order to avoid the WebService to break we must double check that URLs coming from auth plugins are valid.
This commit is contained in:
Juan Leyva
2019-10-31 12:03:39 +01:00
parent 5b39bf184d
commit 62a08b1df8
2 changed files with 38 additions and 0 deletions
+6
View File
@@ -210,6 +210,12 @@ class api {
$identityprovidersdata = \auth_plugin_base::prepare_identity_providers_for_output($identityproviders, $OUTPUT);
if (!empty($identityprovidersdata)) {
$settings['identityproviders'] = $identityprovidersdata;
// Clean URLs to avoid breaking Web Services.
// We can't do it in prepare_identity_providers_for_output() because it may break the web output.
foreach ($settings['identityproviders'] as &$ip) {
$ip['url'] = (!empty($ip['url'])) ? clean_param($ip['url'], PARAM_URL) : '';
$ip['iconurl'] = (!empty($ip['iconurl'])) ? clean_param($ip['iconurl'], PARAM_URL) : '';
}
}
// If age is verified, return also the admin contact details.