<?
require_once "components/Applicant.class.php";
require_once "components/XTemplate.class.php";
require_once "components/Page.class.php";
$tpl = new XTemplate("templates/applicant_reset_password.tpl");
$page = new Page();
$tpl->assign("PAGETITLE","Reset Password - " . $page->title());
$tpl->assign_file("LEFT_COLUMN","templates/left_column_public.tpl");
if (isset($_GET['reset_id']) && $_GET['reset_id'] != '')
{
if (isset($_GET['do']))
{
$user = new Applicant();
$email = $user->get_email_from_resetGUID($_GET['reset_id']);
if ($email)
{
$user->reset_password($_GET['reset_id']);
$tpl->assign("EMAIL",$email);
$tpl->parse("reset_password.been_reset");
}
else
{
$tpl->parse("reset_password.expired");
}
}
else
{
$user = new Applicant();
$email = $user->get_email_from_resetGUID($_GET['reset_id']);
if ($email)
{
$tpl->assign("LINK","?reset_id=".$_GET['reset_id']."&do");
$tpl->assign("EMAIL",$email);
$tpl->parse("reset_password.about_to");
}
else
{
$tpl->parse("reset_password.expired");
}
}
}
else
{
if (isset($_POST['Submit']))
{
$user = new Applicant();
$user->email = $_POST['my_email'];
if ($user->send_password_confirm_email())
{
$tpl->assign("EMAIL",$user->email);
$tpl->parse("reset_password.link_sent");
}
else
{
$tpl->parse("reset_password.not_recognized");
}
}
else
{
$tpl->parse("reset_password.enter_email");
}
}
$tpl->parse("reset_password");
$tpl->out("reset_password");
?>