diff --git a/admin/tool/mobile/classes/api.php b/admin/tool/mobile/classes/api.php index 7d1674a99f5..91dfbdaf80e 100644 --- a/admin/tool/mobile/classes/api.php +++ b/admin/tool/mobile/classes/api.php @@ -128,7 +128,7 @@ class api { 'rememberusername' => $CFG->rememberusername, 'authloginviaemail' => $CFG->authloginviaemail, 'registerauth' => $CFG->registerauth, - 'forgottenpasswordurl' => $CFG->forgottenpasswordurl, + 'forgottenpasswordurl' => clean_param($CFG->forgottenpasswordurl, PARAM_URL), // We may expect a mailto: here. 'authinstructions' => $authinstructions, 'authnoneenabled' => (int) is_enabled_auth('none'), 'enablewebservices' => $CFG->enablewebservices, diff --git a/admin/tool/mobile/tests/externallib_test.php b/admin/tool/mobile/tests/externallib_test.php index 328011a492e..3f7bac803b1 100644 --- a/admin/tool/mobile/tests/externallib_test.php +++ b/admin/tool/mobile/tests/externallib_test.php @@ -97,11 +97,13 @@ class tool_mobile_external_testcase extends externallib_advanced_testcase { set_config('typeoflogin', api::LOGIN_VIA_BROWSER, 'tool_mobile'); set_config('logo', 'mock.png', 'core_admin'); set_config('logocompact', 'mock.png', 'core_admin'); + set_config('forgottenpasswordurl', 'mailto:fake@email.zy'); // Test old hack. list($authinstructions, $notusedformat) = external_format_text($authinstructions, FORMAT_MOODLE, $context->id); $expected['registerauth'] = 'email'; $expected['authinstructions'] = $authinstructions; $expected['typeoflogin'] = api::LOGIN_VIA_BROWSER; + $expected['forgottenpasswordurl'] = ''; // Expect empty when it's not an URL. if ($logourl = $OUTPUT->get_logo_url()) { $expected['logourl'] = $logourl->out(false);