From dcdca4504566a9242a784188ad583393b9a9f388 Mon Sep 17 00:00:00 2001 From: 0x7d5 <86822737+VladimirLapskiy@users.noreply.github.com> Date: Sun, 10 Oct 2021 13:41:38 +0500 Subject: [PATCH] registration: Added field birthday --- Web/Presenters/AuthPresenter.php | 4 ++++ Web/Presenters/templates/Auth/Register.xml | 10 +++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/Web/Presenters/AuthPresenter.php b/Web/Presenters/AuthPresenter.php index 90333151..4532df3a 100644 --- a/Web/Presenters/AuthPresenter.php +++ b/Web/Presenters/AuthPresenter.php @@ -92,6 +92,9 @@ final class AuthPresenter extends OpenVKPresenter $chUser = ChandlerUser::create($this->postParam("email"), $this->postParam("password")); if(!$chUser) $this->flashFail("err", "Не удалось зарегистрироваться", "Пользователь с таким email уже существует."); + + if (!strtotime($this->postParam("birthday")) < time()) + $this->flashFail("err", "Неверная дата рождения", "Дату рождения, которую вы ввели, не является корректным."); $user = new User; $user->setUser($chUser->getId()); @@ -101,6 +104,7 @@ final class AuthPresenter extends OpenVKPresenter $user->setEmail($this->postParam("email")); $user->setSince(date("Y-m-d H:i:s")); $user->setRegistering_Ip(CONNECTING_IP); + $user->setBirthday(strtotime($this->postParam("birthday"))); $user->save(); if(!is_null($referer)) { diff --git a/Web/Presenters/templates/Auth/Register.xml b/Web/Presenters/templates/Auth/Register.xml index 9ea387d7..9ae37b91 100644 --- a/Web/Presenters/templates/Auth/Register.xml +++ b/Web/Presenters/templates/Auth/Register.xml @@ -24,7 +24,7 @@