Store usernames in lowercases. #1225

This commit is contained in:
dignajar 2020-07-13 11:53:48 +02:00
parent 0f7a290b6a
commit b363a684f2

View file

@ -39,6 +39,7 @@ class Users extends dbJSON {
// Return an array with the database of the user, FALSE otherwise // Return an array with the database of the user, FALSE otherwise
public function getUserDB($username) public function getUserDB($username)
{ {
$username = Text::lowercase($username);
if ($this->exists($username)) { if ($this->exists($username)) {
return $this->db[$username]; return $this->db[$username];
} }
@ -48,12 +49,14 @@ class Users extends dbJSON {
// Return TRUE if the user exists, FALSE otherwise // Return TRUE if the user exists, FALSE otherwise
public function exists($username) public function exists($username)
{ {
$username = Text::lowercase($username);
return isset($this->db[$username]); return isset($this->db[$username]);
} }
// Disable the user // Disable the user
public function disableUser($username) public function disableUser($username)
{ {
$username = Text::lowercase($username);
$this->db[$username]['password'] = '!'; $this->db[$username]['password'] = '!';
return $this->save(); return $this->save();
} }