/** * Initiates the login */ function init_login() { $cfg = EasySCP_Registry::get('Config'); // just make sure to expire counters in case BRUTEFORCE is turned off unblock($cfg->BRUTEFORCE_BLOCK_TIME); if ($cfg->BRUTEFORCE) { is_ipaddr_blocked(null, 'bruteforce', true); } }
check_input($_GET['key']); $template = 'lostpassword_message.tpl'; if (sendpassword($_GET['key'])) { $tpl->assign(array('TR_MESSAGE' => tr('Your new password has been sent.'), 'TR_LINK' => '<a href="index.php" class="button">' . tr('Login') . '</a>')); } else { $tpl->assign(array('TR_MESSAGE' => tr('New password could not be sent.'), 'TR_LINK' => '<a href="index.php" class="button">' . tr('Login') . '</a>')); } } elseif (isset($_POST['uname'])) { check_ipaddr(getipaddr(), 'captcha'); $template = 'lostpassword_message.tpl'; if (!empty($_POST['uname']) && isset($_SESSION['image']) && isset($_POST['capcode'])) { check_input(trim($_POST['uname'])); check_input($_POST['capcode']); if ($_SESSION['image'] == $_POST['capcode'] && requestpassword($_POST['uname'])) { $tpl->assign(array('TR_MESSAGE' => tr('Your password request has been initiated. You will receive an email with instructions to complete the process. This reset request will expire in %s minutes.', $cfg->LOSTPASSWORD_TIMEOUT), 'TR_LINK' => '<a href="index.php" class="button">' . tr('Back') . '</a>')); } else { $tpl->assign(array('TR_MESSAGE' => tr('User or security code was incorrect!'), 'TR_LINK' => '<a href="lostpassword.php" class="button">' . tr('Retry') . '</a>')); } } else { $tpl->assign(array('TR_MESSAGE' => tr('Please fill out all required fields!'), 'TR_LINK' => '<a href="lostpassword.php" class="button">' . tr('Retry') . '</a>')); } } else { unblock($cfg->BRUTEFORCE_BLOCK_TIME, 'captcha'); is_ipaddr_blocked(null, 'captcha', true); $template = 'lostpassword.tpl'; $tpl->assign(array('TR_CAPCODE' => tr('Security code'), 'TR_IMGCAPCODE_DESCRIPTION' => tr('(To avoid abuse, we ask you to write the combination of letters on the above picture into the field "Security code")'), 'TR_IMGCAPCODE' => '<img src="imagecode.php" style="border: none;height: ' . $cfg->LOSTPASSWORD_CAPTCHA_HEIGHT . 'px;width: ' . $cfg->LOSTPASSWORD_CAPTCHA_WIDTH . 'px;" alt="captcha image" />', 'TR_USERNAME' => tr('Username'), 'TR_SEND' => tr('Request password'), 'TR_BACK' => tr('Back'))); } if ($cfg->DUMP_GUI_DEBUG) { dump_gui_debug($tpl); } $tpl->display($template);