mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2025-01-08 08:57:33 +01:00
Added password change (#2239)
This commit is contained in:
parent
fcd4a2fad7
commit
06de3fde9a
@ -70,6 +70,27 @@ abstract class AuthMeController {
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Changes password for player.
|
||||||
|
*
|
||||||
|
* @param string $username the username
|
||||||
|
* @param string $password the password
|
||||||
|
* @return bool true whether or not password change was successful
|
||||||
|
*/
|
||||||
|
function changePassword($username, $password) {
|
||||||
|
$mysqli = $this->getAuthmeMySqli();
|
||||||
|
if ($mysqli !== null) {
|
||||||
|
$hash = $this->hash($password);
|
||||||
|
$stmt = $mysqli->prepare('UPDATE ' . self::AUTHME_TABLE . ' SET password=? '
|
||||||
|
. 'WHERE username=?');
|
||||||
|
$username_low = strtolower($username);
|
||||||
|
$stmt->bind_param('ss', $hash, $username_low);
|
||||||
|
return $stmt->execute();
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Hashes the given password.
|
* Hashes the given password.
|
||||||
|
Loading…
Reference in New Issue
Block a user