Issue#74 Case (in)sensitive login

This commit is contained in:
Marcin Łojewski
2018-10-28 17:40:12 +01:00
parent 9ab6df0f76
commit 0905096612
8 changed files with 29 additions and 9 deletions

View File

@@ -53,18 +53,26 @@ class UserRepository
}
/**
* Get a user entity object.
* Get an user entity object.
*
* @param string $uid The user ID.
* @param string $uid The user ID.
* @param bool $caseSensitive TRUE for case sensitive search,
* FALSE for case insensitive search.
*
* @return User The user entity, NULL if it does not exists or
* FALSE on failure.
*/
public function findByUid($uid)
public function findByUid($uid, $caseSensitive = true)
{
return $this->dataQuery->queryEntity(
Query::FIND_USER, User::class, [Query::UID_PARAM => $uid]
);
if ($caseSensitive) {
return $this->dataQuery->queryEntity(
Query::FIND_USER, User::class, [Query::UID_PARAM => $uid]
);
} else {
return $this->dataQuery->queryEntity(
Query::FIND_USER_CASE_INSENSITIVE, User::class, [Query::UID_PARAM => $uid]
);
}
}
/**