fix activationMessage issue

This commit is contained in:
mobinajafarian 2023-06-13 10:09:15 +03:30
parent 053c6c1a1c
commit ef8b18ad12

View file

@ -32,15 +32,16 @@ class Auth
return bin2hex(openssl_random_pseudo_bytes(32)); return bin2hex(openssl_random_pseudo_bytes(32));
} }
// public function activationMessage($username, $verifyToken) public function activationMessage($username, $verifyToken)
// { {
// $message = ' $message = "
// <h1>Account activation</h1> <h1>Account activation</h1>
// <p>' . $username . Dear, to activate your account, please click on the link below'</p> <h4>Dear $username</h4>
// <div><a href="' . url('activation/' . $verifyToken) . '">Account activation</a></div> <p>to activate your account, please click on the link below</p>
// '; <div><a href=" . url('activation/' . $verifyToken) . ">Account activation</a></div>
// return $message; ";
// } return $message;
}
public function sendMail($emailAddress, $subject, $body) public function sendMail($emailAddress, $subject, $body)
{ {
@ -100,19 +101,18 @@ class Auth
$this->redirectBack(); $this->redirectBack();
} else { } else {
$randomToken = $this->random(); $randomToken = $this->random();
// $activationMessage = $this->activationMessage($request['username'], $randomToken); $activationMessage = $this->activationMessage($request['username'], $randomToken);
// $result = $this->sendMail($request['email'], 'Account activation', $activationMessage); $result = $this->sendMail($request['email'], 'Account activation', $activationMessage);
// if($result) if ($result) {
// { $request['verify_token'] = $randomToken;
$request['verify_token'] = $randomToken; $request['password'] = $this->hash($request['password']);
$request['password'] = $this->hash($request['password']); $db->insert('users', array_keys($request), $request);
$db->insert('users', array_keys($request), $request); $this->redirect('login');
$this->redirect('login'); }
// }
} }
// flash('register_error', 'The activation email was not sent'); flash('register_error', 'The activation email was not sent');
$this->redirectBack(); $this->redirectBack();
} }