diff --git a/website/app/GeoKrety/Controller/Pages/UserContact.php b/website/app/GeoKrety/Controller/Pages/UserContact.php index 33c9bf55d3..65652b5a05 100644 --- a/website/app/GeoKrety/Controller/Pages/UserContact.php +++ b/website/app/GeoKrety/Controller/Pages/UserContact.php @@ -67,6 +67,10 @@ public function get_ajax(\Base $f3) { } public function post(\Base $f3) { + if ($this->currentUser->isFreshUser()) { + Danger::message(_('Action is not possible'), _('Action is not possible')); + exit; + } if (!$this->currentUser->isEmailValid()) { Danger::message(_('Your email address must be validated before you can contact other players.'), _('Action is not possible')); exit; diff --git a/website/app/GeoKrety/Model/User.php b/website/app/GeoKrety/Model/User.php index 75acc216c4..ac90bcbf44 100644 --- a/website/app/GeoKrety/Model/User.php +++ b/website/app/GeoKrety/Model/User.php @@ -340,6 +340,10 @@ public function accountStatusText(): string { return self::ACCOUNT_STATUS_TEXT[$this->account_valid]; } + public function isFreshUser(): bool { + return (new \DateTime())->diff($this->joined_on_datetime)->d <= 7; + } + public function emailStatusText(): string { return self::USER_EMAIL_TEXT[$this->email_invalid]; }