fotgot

 avatar
iamvu
php
3 months ago
525 B
5
Indexable
<?php
public function forgotPassword()
    {
        if ($_SERVER['REQUEST_METHOD'] === 'POST') {
            $otp = rand(100000, 999999);

            $email = $_POST['email'] ?? '';
            $_SESSION['email_forgot'] = $email;
            $this->UserModel->setOtp($email, $otp);
            $this->mailer->send($email, 'OTP Verification', "Your OTP is: $otp");
            header('Location: /resetpassword');
        } else {
            renderView('view/auth/forgotpassword.php', [], 'Forgot Password');
        }
    }
Editor is loading...
Leave a Comment