Fix OAuth account registration with banned email

This commit is contained in:
Visman 2023-07-22 22:19:14 +07:00
parent 717dbe456a
commit 77fa96cbc3
3 changed files with 20 additions and 0 deletions

View file

@ -157,6 +157,13 @@ class RegLog extends Page
return $redirect->message(['Email registered by another', __($provider->name)], FORK_MESS_WARN, self::TIMEOUT);
}
$user = $this->c->users->create(['email' => $provider->userEmail]);
// этот email забанен
if (1 === $this->c->bans->isBanned($user)) {
return $redirect->message(['Email banned', __($provider->name)], FORK_MESS_WARN, self::TIMEOUT);
}
if (true !== $this->c->providerUser->registration($this->user, $provider)) {
throw new RuntimeException('Failed to insert data'); // ??????????????????????????????????????????
}
@ -192,6 +199,13 @@ class RegLog extends Page
return $this->c->Message->message('No new regs');
}
$user = $this->c->users->create(['email' => $provider->userEmail]);
// этот email забанен
if (1 === $this->c->bans->isBanned($user)) {
return $this->c->Message->message(['Email banned', __($provider->name)], false);
}
// продолжение регистрации начиная с согласия с правилами
if ('reg' !== $provider->stateType) {
$page = $this->c->Rules->confirmation();

View file

@ -122,3 +122,6 @@ msgstr "Account removed."
msgid "First time Register?"
msgstr "You are here for the first time. Register?"
msgid "Email banned"
msgstr "The email address received from %s is banned."

View file

@ -122,3 +122,6 @@ msgstr "Аккаунт удален."
msgid "First time Register?"
msgstr "Вы здесь впервые. Зарегистрируетесь?"
msgid "Email banned"
msgstr "Адрес электронной почты полученный от %s забанен."