Update Redirect page

This commit is contained in:
Visman 2023-05-13 14:32:58 +07:00
parent e82b04ba22
commit d271bec869
6 changed files with 14 additions and 27 deletions

View file

@ -46,7 +46,7 @@ class Redirect extends Page
/**
* Задает сообщение
*/
public function message(string|array $message, ?int $timeout = 0): Page
public function message(string|array $message, string $status = FORK_MESS_INFO, int $timeout = 0): Page
{
// переадресация без вывода сообщения
if (
@ -58,7 +58,8 @@ class Redirect extends Page
$this->nameTpl = 'layouts/redirect';
$this->robots = 'noindex';
$this->message = $message;
$this->fIswev = [$status, $message];
$this->fIswev = [$status, ['Redirecting...', $this->link]];
$this->timeout = $timeout > 0 ? $timeout : $this->c->config->i_redirect_delay;
return $this;

View file

@ -146,11 +146,11 @@ class RegLog extends Page
// аккаунт есть и он привязан к текущему пользователю
if ($uid === $this->user->id) {
return $redirect->message('Already linked to you', 5);
return $redirect->message('Already linked to you', FORK_MESS_SUCC, 5);
// аккаунт есть и он привязан к другому пользователю
} elseif ($uid > 0) {
return $redirect->message('Already linked to another', 5);
return $redirect->message('Already linked to another', FORK_MESS_WARN, 5);
}
$uid = $this->c->providerUser->findEmail($provider);
@ -160,7 +160,7 @@ class RegLog extends Page
$uid
&& $uid !== $this->user->id
) {
return $redirect->message(['Email registered by another', __($provider->name)], 5);
return $redirect->message(['Email registered by another', __($provider->name)], FORK_MESS_WARN, 5);
}
$user = $this->c->users->loadByEmail($provider->userEmail);
@ -170,14 +170,14 @@ class RegLog extends Page
$user instanceof User
&& $user !== $this->user
) {
return $redirect->message(['Email registered by another', __($provider->name)], 5);
return $redirect->message(['Email registered by another', __($provider->name)], FORK_MESS_WARN, 5);
}
if (true !== $this->c->providerUser->registration($this->user, $provider)) {
throw new RuntimeException('Failed to insert data'); // ??????????????????????????????????????????
}
return $redirect->message('Account linked');
return $redirect->message('Account linked', FORK_MESS_SUCC);
}
}

View file

@ -125,10 +125,7 @@ msgid "Redirecting"
msgstr "Redirecting"
msgid "Redirecting..."
msgstr "Redirecting …"
msgid "Click redirect"
msgstr "Click here if you do not want to wait any longer (or if your browser does not automatically forward you)"
msgstr "<a href=\"%s\">Redirecting …</a>"
msgid "on"
msgstr "on"

View file

@ -125,10 +125,7 @@ msgid "Redirecting"
msgstr "Перенаправление"
msgid "Redirecting..."
msgstr "Переадресация …"
msgid "Click redirect"
msgstr "Кликните здесь, если не желаете ждать (или ваш браузер не поддерживает перенаправление)."
msgstr "<a href=\"%s\">Переадресация …</a>"
msgid "on"
msgstr "вкл."

View file

@ -18,8 +18,9 @@
<main id="fork-main">
<aside id="fork-rdrct" class="f-main">
<h2 id="id-rdrct-h2">{!! __('Redirecting') !!}</h2>
<p class="f-rdrct-p">{!! __($p->message) !!} {!! __('Redirecting...') !!}</p>
<p class="f-rdrct-p"><a href="{{ $p->link }}">{!! __('Click redirect') !!}</a></p>
@if ($iswev = $p->fIswev)
@include ('layouts/iswev')
@endif
</aside>
</main>
<footer id="fork-footer">

View file

@ -1046,19 +1046,10 @@ body,
/************/
/* Редирект */
/************/
#fork #fork-rdrct {
border: 0.0625rem solid #AA7939;
}
#fork-rdrct #id-rdrct-h2 {
display: block;
padding: 0.625rem;
background-color: #F8F4E3;
border-bottom: 0.0625rem solid #AA7939;
}
#fork-rdrct .f-rdrct-p {
padding: 0.625rem;
text-align: center;
}
/*********************/