mirror of
https://github.com/delight-im/PHP-Auth.git
synced 2025-08-02 22:27:30 +02:00
No need to check for uniqueness of username if none has been provided
This commit is contained in:
@@ -719,6 +719,8 @@ class Auth {
|
|||||||
|
|
||||||
// if the uniqueness of the username is to be ensured
|
// if the uniqueness of the username is to be ensured
|
||||||
if ($requireUniqueUsername) {
|
if ($requireUniqueUsername) {
|
||||||
|
// if a username has actually been provided
|
||||||
|
if ($username !== null) {
|
||||||
// count the number of users who do already have that specified username
|
// count the number of users who do already have that specified username
|
||||||
$occurrencesOfUsername = $this->db->selectValue(
|
$occurrencesOfUsername = $this->db->selectValue(
|
||||||
'SELECT COUNT(*) FROM users WHERE username = ?',
|
'SELECT COUNT(*) FROM users WHERE username = ?',
|
||||||
@@ -731,6 +733,7 @@ class Auth {
|
|||||||
throw new DuplicateUsernameException();
|
throw new DuplicateUsernameException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$password = password_hash($password, PASSWORD_DEFAULT);
|
$password = password_hash($password, PASSWORD_DEFAULT);
|
||||||
$verified = isset($callback) && is_callable($callback) ? 0 : 1;
|
$verified = isset($callback) && is_callable($callback) ? 0 : 1;
|
||||||
|
Reference in New Issue
Block a user