Skip to content

Commit

Permalink
chore: New users cannot send emails
Browse files Browse the repository at this point in the history
  • Loading branch information
geokrety-bot committed Dec 12, 2024
1 parent 1c0bb37 commit 4c5054e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions website/app/GeoKrety/Controller/Pages/UserContact.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 4 additions & 0 deletions website/app/GeoKrety/Model/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -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];
}
Expand Down

0 comments on commit 4c5054e

Please sign in to comment.