Skip to content

Commit

Permalink
fix: Change emails tokens, expiry issue
Browse files Browse the repository at this point in the history
Closes #861
  • Loading branch information
kumy committed Oct 8, 2023
1 parent cdb34d5 commit eea0e48
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion website/app/GeoKrety/Model/EmailActivationToken.php
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,11 @@ public function get_reverted_on_datetime($value): ?\DateTime {
public static function expireOldTokens(): void { // TODO: move this to plpgsql
$activation = new EmailActivationToken();
$expiredTokens = $activation->find([
'used = ? AND (created_on_datetime > NOW() - cast(? as interval) OR used_on_datetime > NOW() - cast(? as interval))',
'used = ? AND (
created_on_datetime + cast(? as interval) <= NOW()
OR
used_on_datetime + cast(? as interval) <= NOW()
)',
self::TOKEN_UNUSED,
GK_SITE_EMAIL_ACTIVATION_CODE_DAYS_VALIDITY.' DAY',
GK_SITE_EMAIL_REVERT_CODE_DAYS_VALIDITY.' DAY',
Expand Down

0 comments on commit eea0e48

Please sign in to comment.