mirror of
https://github.com/flarum/core.git
synced 2025-10-15 00:44:40 +02:00
Make sure access/email/password tokens are valid
This commit is contained in:
@@ -5,6 +5,7 @@ use Flarum\Events\UserWillBeSaved;
|
||||
use Flarum\Core\Support\DispatchesEvents;
|
||||
use Flarum\Core\Exceptions\InvalidConfirmationTokenException;
|
||||
use Flarum\Core\Users\EmailToken;
|
||||
use DateTime;
|
||||
|
||||
class ConfirmEmailHandler
|
||||
{
|
||||
@@ -32,7 +33,7 @@ class ConfirmEmailHandler
|
||||
{
|
||||
$token = EmailToken::find($command->token);
|
||||
|
||||
if (! $token) {
|
||||
if (! $token || $token->created_at < new DateTime('-1 day')) {
|
||||
throw new InvalidConfirmationTokenException;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user