fix: #108 channel redirection

This commit is contained in:
grandeljay 2023-12-17 13:08:29 +01:00
parent d50d4b0aab
commit c6896f91c0
2 changed files with 4 additions and 4 deletions

View file

@ -530,9 +530,9 @@ class User
$this->birthdate = $birthdate;
}
public function getChannel(): string
public function getChannel(): string|null
{
return $this->channel;
return $this->channel ?? null;
}
public function setChannel(string $channel): void

View file

@ -32,14 +32,14 @@ function redirect(string $target)
if (
defined('CHANNELS')
&& is_array(CHANNELS)
&& isset($user->channel)
&& $user->getChannel()
&& !$isDevEnvironment
) {
$host = null;
foreach (CHANNELS as $channel) {
if (
$channel['branch'] === $user->channel
$channel['branch'] === $user->getChannel()
&& $channel['host'] !== $_SERVER['HTTP_HOST']
&& $isHostInChannel
) {