$this->jerr("Invalid request to reset password");
}
- $this->verifyCheckSum($_REQUEST['id'], $_REQUEST['ts'], $_REQUEST['key']);
+ $this->verifyResetPassword($_REQUEST['id'], $_REQUEST['ts'], $_REQUEST['key']);
+ $this->jok("Checksum is ok");
}
// this is 'classic' change password...
}
-
- function resetPassword($id,$t, $key, $newpass )
+ function verifyResetPassword($id,$t, $key)
{
-
- $au = $this->getAuthUser();
+ $au = $this->getAuthUser();
+ print_R($au);
if ($au) {
- return "Already Logged in - no need to use Password Reset";
+ $this->jerr( "Already Logged in - no need to use Password Reset");
}
$u = DB_DataObject::factory('core_person');
if ($t < strtotime("NOW - 1 DAY")) {
$this->jerr("Password reset link has expired");
}
+ return $u;
+
+
+
+ }
+
+
+ function resetPassword($id,$t, $key, $newpass )
+ {
+
+ $u = $this->verifyResetPassword($id,$t,$key);
+
$uu = clone($u);
$u->no_reset_sent = 0;
$u->setPassword($newpass);
}
$u->update($uu);
- $u->login();
+ $this->addEvent("CHANGEPASS", $au);
+
$this->jok("Password has been Updated");
}