コード例 #1
0
ファイル: Account.php プロジェクト: Oluwafemikorede/gbedu
 public function forgotpassword()
 {
     $this->data['title'] = 'Retrieve Password';
     $hash_model = new \models\hash();
     if (isset($_POST['email']) && !empty($_POST['email'])) {
         $user_details = $this->user_model->getColRow('user_email', $_POST['email']);
         if ($user_details->user_email != '') {
             $get_status = $this->status_model->getColRow('status_title', 'active');
             $uniqid = uniqid();
             $insert = $hash_model->create(array('hash_user_id' => $user_details->user_id, 'hash_value' => $uniqid, 'hash_status_id' => $get_status->status_id));
             //SEND ACCOUNT DETAILS TO USER
             $fullname = $user_details->user_firstname . ' ' . $user_details->user_lastname;
             $subject = 'Reset Password';
             $content .= "You have requested for a new password, please click the link below to reset";
             $content .= '<a href="' . DIR . 'account/resetpassword/' . $uniqid . '" target="_blank">Get Password </a>';
             $mail = new \helpers\phpmailer\mail();
             $mail->general($user_details->user_email, $subject, $fullname, $content);
             $this->data['success'] = "Congrats!, A reset link has been sent to your email";
         } else {
             $this->data['error'] = 'This email does not exist in our records!';
         }
     }
     View::rendertemplate('header', $this->data);
     View::render('account/forgotpassword', $this->data);
     View::rendertemplate('footer', $this->data);
 }