mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 06:18:28 +01:00
Don't allow guest user to change or reset password
This commit is contained in:
parent
64eacd6f76
commit
0bb2c9f70c
@ -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);
|
||||
|
@ -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");
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user