Selaa lähdekoodia

Add sending an email to reset the passphrase when trying to re-register

Visman 2 vuotta sitten
vanhempi
commit
482061f54d
1 muutettua tiedostoa jossa 13 lisäystä ja 0 poistoa
  1. 13 0
      app/Models/Pages/Register.php

+ 13 - 0
app/Models/Pages/Register.php

@@ -476,6 +476,19 @@ class Register extends Page
             && 1 === $this->c->config->b_regs_verify
         ) {
             $isSent = true;
+            $flood  = \time() - $userInDB->last_email_sent;
+
+            // отправка письма на сброс кодовой фразы
+            // костыль
+            if ($flood >= $this->c->FLOOD_INTERVAL) {
+                $_POST = [
+                    'token'  => $this->c->Csrf->create('Forget'),
+                    'email'  => $email,
+                    'submit' => 'From dupe registration',
+                ];
+
+                $this->c->Auth->forget([], 'POST');
+            }
 
             // письмо активации аккаунта отправлено
             if ($isSent) {