fix: #108 channel redirection
This commit is contained in:
parent
d50d4b0aab
commit
c6896f91c0
2 changed files with 4 additions and 4 deletions
|
@ -530,9 +530,9 @@ class User
|
||||||
$this->birthdate = $birthdate;
|
$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
|
public function setChannel(string $channel): void
|
||||||
|
|
|
@ -32,14 +32,14 @@ function redirect(string $target)
|
||||||
if (
|
if (
|
||||||
defined('CHANNELS')
|
defined('CHANNELS')
|
||||||
&& is_array(CHANNELS)
|
&& is_array(CHANNELS)
|
||||||
&& isset($user->channel)
|
&& $user->getChannel()
|
||||||
&& !$isDevEnvironment
|
&& !$isDevEnvironment
|
||||||
) {
|
) {
|
||||||
$host = null;
|
$host = null;
|
||||||
|
|
||||||
foreach (CHANNELS as $channel) {
|
foreach (CHANNELS as $channel) {
|
||||||
if (
|
if (
|
||||||
$channel['branch'] === $user->channel
|
$channel['branch'] === $user->getChannel()
|
||||||
&& $channel['host'] !== $_SERVER['HTTP_HOST']
|
&& $channel['host'] !== $_SERVER['HTTP_HOST']
|
||||||
&& $isHostInChannel
|
&& $isHostInChannel
|
||||||
) {
|
) {
|
||||||
|
|
Loading…
Reference in a new issue