From 65acd2bb971eaaa3be24ed32272a13ba04bf7268 Mon Sep 17 00:00:00 2001 From: skodak Date: Sat, 21 Apr 2007 21:20:17 +0000 Subject: [PATCH] MDL-2201 handle url parameters in change Password link --- user/view.php | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/user/view.php b/user/view.php index 81eb4f92b3..03cc1b38aa 100644 --- a/user/view.php +++ b/user/view.php @@ -356,7 +356,7 @@ $userauth = get_auth_plugin($user->auth); $passwordchangeurl = false; - if ($currentuser and $userauth->can_change_password() and !isguest()) { //TODO: add proper capability for password changing + if (/*$currentuser and */$userauth->can_change_password() and !isguest()) { //TODO: add proper capability for password changing if ($userauth->change_password_url()) { $passwordchangeurl = $userauth->change_password_url(); } else { @@ -372,12 +372,26 @@ echo '
'; if ($passwordchangeurl) { + $params = array('id'=>$course->id); + if (!empty($USER->realuser)) { $passwordchangeurl = ''; // do not use actual change password url - might contain sensitive data + } else { + $parts = explode('?', $passwordchangeurl); + $passwordchangeurl = reset($parts); + $after = next($parts); + preg_match_all('/([^&=]+)=([^&=]+)/', $after, $matches); + if (count($matches)) { + foreach($matches[0] as $key=>$match) { + $params[$matches[1][$key]] = $matches[2][$key]; + } + } } echo "
"; echo "
"; - echo "id\" />"; + foreach($params as $key=>$value) { + echo ''; + } if (!empty($USER->realuser)) { // changing of password when "Logged in as" is not allowed echo ""; -- 2.39.5