fix: Improve string comparison

Signed-off-by: Cleopatra Enjeck M. <patrathewhiz@gmail.com>
This commit is contained in:
Cleopatra Enjeck M. 2025-02-25 06:36:53 +00:00 committed by Enjeck
parent 6690a28cc0
commit a6d6a1fa9e

View file

@ -780,7 +780,7 @@ class Session implements IUserSession, Emitter {
* Check if login names match
*/
private function validateTokenLoginName(?string $loginName, IToken $token): bool {
if (strtolower($token->getLoginName() ?? '') !== strtolower($loginName ?? '')) {
if (strcasecmp($token->getLoginName(), $loginName ?? '') !== 0) {
// TODO: this makes it impossible to use different login names on browser and client
// e.g. login by e-mail 'user@example.com' on browser for generating the token will not
// allow to use the client token with the login name 'user'.