Don't allow guest user to change or reset password

This commit is contained in:
martin 2002-08-05 16:12:36 +00:00
parent 64eacd6f76
commit 0bb2c9f70c
2 changed files with 15 additions and 4 deletions

View File

@ -13,15 +13,22 @@
if (!count((array)$err)) {
$username = $frm->username;
$password = $frm->newpassword1;
$password = md5($frm->newpassword1);
if (! set_field("user", "password", md5($frm->newpassword1), "username", $frm->username)) {
$user = get_user_info_from_db("username", $username);
if (isguest($user->id)) {
error("Can't change guest password!");
}
if (set_field("user", "password", $password, "username", $username)) {
$user->password = $password;
} else {
error("Could not set the new password");
}
unset($USER);
$USER = get_user_info_from_db("username", $username);
$USER = $user;
$USER->loggedin = true;
set_moodle_cookie($USER->username);

View File

@ -16,6 +16,10 @@
error("No such user with this address: $frm->email");
}
if (isguest($user->id)) {
error("Can't change guest password!");
}
if (! reset_password_and_mail($user)) {
error("Could not reset password and mail the new one to you");
}