diff --git a/login/forgot_password.php b/login/forgot_password.php index 5f376a298b7..579a88b13f6 100644 --- a/login/forgot_password.php +++ b/login/forgot_password.php @@ -77,6 +77,10 @@ if ($p_secret !== false) { notice(get_string('emailpasswordsent', '', $a), $changepasswordurl); } else { + if (!empty($user) and strlen($p_secret) === 15) { + // somebody probably tries to hack in by guessing secret - stop them! + set_field('user', 'secret', '', 'id', $user->id); + } print_header($strforgotten, $strforgotten, $navigation); print_error('forgotteninvalidurl'); }