Skip to content

Commit

Permalink
refactor(SessionStorage): add username trimming
Browse files Browse the repository at this point in the history
  • Loading branch information
ncosta-ic authored and nilmerg committed Jun 12, 2024
1 parent 3be1b33 commit 0028789
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions library/Notifications/ProvidedHook/SessionStorage.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public function onLogin(User $user): void

// cleanup existing sessions from this user (only for the current browser)
$userSessions = BrowserSession::on(Database::get())
->filter(Filter::equal('username', $user->getUsername()))
->filter(Filter::equal('username', trim($user->getUsername())))
->filter(Filter::equal('user_agent', $userAgent))
->execute();
/** @var BrowserSession $session */
Expand Down Expand Up @@ -104,7 +104,10 @@ public function onLogin(User $user): void
}

Logger::debug(
"onLogin triggered for user " . $user->getUsername() . " and browser session " . $this->session->getId()
"onLogin triggered for user "
. trim($user->getUsername())
. " and browser session "
. $this->session->getId()
);
}
}
Expand Down Expand Up @@ -145,7 +148,7 @@ public function onLogout(User $user): void

Logger::debug(
"onLogout triggered for user "
. $user->getUsername()
. trim($user->getUsername())
. " and browser session "
. $this->session->getId()
);
Expand Down

0 comments on commit 0028789

Please sign in to comment.