NobodysHero |
04-06-2016 12:50 PM |
Okay, so I got the reply from tech support for my web host and they said it's enabled, but I still can't do anything with passwords, sending resets or setting a new one on my own. I even tried to send the email using the form in the ACP and that didn't work.
Here is my forgotpass.php file:
PHP Code:
<?php
use Resource\Native\String as String;
class ForgotpassController extends AppController{
public function __construct(){
parent::__construct("guest");
}
public function index(){
$mysidia = Registry::get("mysidia");
if($mysidia->input->post("submit")){
$user = $mysidia->db->select("users", array("username", "email", "ip"), "username = '{$mysidia->input->post("username")}' and email = '{$mysidia->input->post("email")}'")->fetchObject();
if(!is_object($user)) throw new PasswordException("match");
else{
$rand = codegen(10);
$date = new DateTime;
$mysidia->db->insert("passwordresets", array("id" => NULL, "username" => $mysidia->input->post("username"), "email" => $mysidia->input->post("email"), "code" => $rand, "ip" => $_SERVER['REMOTE_ADDR'], "date" => $date->format('Y-m-d')));
$headers = "From: {$mysidia->settings->systememail}";
$message = "Hello there {$mysidia->input->post("username")}:\n\nOur records indicate that you requested a password reset for your account. Below is your reset code:\n
Reset Code: {$rand}\n\nTo have your password changed please visit the following URL:\n
{$mysidia->path->getAbsolute()}forgotpass/reset
\n\nIf you did NOT request a password reset then please ignore this email to keep your current password.\n\n
Thanks,\nThe {$sitename} team.";
mail($mysidia->input->post("email"), "Password Reset Request for {$mysidia->input->post("username")}", $message, $headers);
}
return;
}
}
public function reset(){
$mysidia = Registry::get("mysidia");
if($mysidia->input->post("submit")){
$passwordResets = $mysidia->db->select("passwordresets", array(), "username = '{$mysidia->input->post("username")}' and email = '{$mysidia->input->post("email")}' and code='{$mysidia->input->post("resetcode")}' ORDER BY id DESC LIMIT 1")->fetchObject();
if(!is_object($passwordResets)) throw new InvalidCodeException("invalidcode");
else{
$newPass = $mysidia->user->reset($passwordResets->username, $passwordResets->email);
$this->setField("newPass", new String($newPass));
}
return;
}
}
}
?>
That I'm aware of, none of the code has been changed from install. I'm at a total loss here and I have a few members who currently can't access their accounts. Any and all help is, was, and will always be appreciated.
|