LDAP Change password URL

LDAP Change password URL

by Gisela Hillenbrand -
Number of replies: 2
Picture of Documentation writers
Hi,

we are using LDAP authentification with the settings:
  • Use standrad change password page: No
  • Change password URL: <website where users can change their LDAP password>
In Moodle 1.5.+, in the users profile their was a button "Change password" which led to the URL given above.

In Moodle 1.6 / 1.7 I miss this button in the users profile.

What happened here and how users can now change their passwords?

Gisela
Average of ratings: -
In reply to Gisela Hillenbrand

Re: LDAP Change password URL

by Iñaki Arenaza -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
It seems there is a bug in 1.6.x and 1.7.x when dealing with password change using external authentication systems (like LDAP).

You need to edit .../moodle/user/view.php and search for this piece of code:

if ($currentuser and !isguest() and !is_restricted_user($USER->username)) {
if ($internalpassword ) {
echo "<td nowrap=\"nowrap\"><form action=\"$internalpassword\" method=\"get\">";
echo "<input type=\"hidden\" name=\"id\" value=\"$course->id\" />";
echo "<input type=\"submit\" value=\"".get_string("changepassword")."\" />";
echo "</form></td>";
} else if ( strlen($CFG->changepassword) > 1 ) {
echo "<td nowrap=\"nowrap\"><form action=\"$CFG->changepassword\" method=\"get\">";
echo "<input type=\"submit\" value=\"".get_string("changepassword")."\" />";
echo "</form></td>";
}
}

and change it to:

if ($currentuser and !isguest() and !is_restricted_user($USER->username)) {
if ($internalpassword ) {
echo "<td nowrap=\"nowrap\"><form action=\"$internalpassword\" method=\"get\">";
echo "<input type=\"hidden\" name=\"id\" value=\"$course->id\" />";
echo "<input type=\"submit\" value=\"".get_string("changepassword")."\" />";
echo "</form></td>";
} else if ( strlen($CFG->{'auth_'.$user->auth.'_changepasswordurl'}) > 1 ) {
echo "<td nowrap=\"nowrap\"><form action=\"".$CFG->{'auth_'.$user->auth.'_changepasswordurl'}."\" method=\"get\">";
echo "<input type=\"submit\" value=\"".get_string("changepassword")."\" />";
echo "</form></td>";
}
}

This should do it.

Saludos. Iñaki.