*/ require '../include/easyscp-lib.php'; $cfg = EasySCP_Registry::get('Config'); if (!$cfg->LOSTPASSWORD) { throw new EasySCP_Exception_Production(tr('Retrieving lost passwords is currently not possible')); } // check if GD library is available if (!check_gd()) { throw new EasySCP_Exception(tr("GD PHP Extension not loaded!")); } // check if captch fonts exist if (!captcha_fontfile_exists()) { throw new EasySCP_Exception(tr("Captcha fontfile not found!")); } // remove old unique keys removeOldKeys($cfg->LOSTPASSWORD_TIMEOUT); if (isset($_SESSION['user_theme'])) { $theme_color = $_SESSION['user_theme']; } else { $theme_color = $cfg->USER_INITIAL_THEME; } $tpl = EasySCP_TemplateEngine::getInstance(); $tpl->assign(array('TR_PAGE_TITLE' => tr('EasySCP - Virtual Hosting Control System'), 'TR_WEBMAIL_SSL_LINK' => 'webmail', 'TR_FTP_SSL_LINK' => 'ftp', 'TR_PMA_SSL_LINK' => 'pma')); // Key request has been triggered if (isset($_GET['key']) && !empty($_GET['key'])) { 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>'));
require_once LIBRARY_PATH . '/Functions/LostPassword.php'; iMSCP_Events_Aggregator::getInstance()->dispatch(iMSCP_Events::onLostPasswordScriptStart); // Purge expired sessions do_session_timeout(); /** @var $cfg iMSCP_Config_Handler_File */ $cfg = iMSCP_Registry::get('config'); // Lost password feature is disabled ? if (!$cfg['LOSTPASSWORD']) { redirectTo('/index.php'); } // Check for gd library availability if (!check_gd()) { throw new iMSCP_Exception(tr("PHP GD extension not loaded.")); } // Remove old unique keys removeOldKeys($cfg['LOSTPASSWORD_TIMEOUT']); $tpl = new iMSCP_pTemplate(); $tpl->define_dynamic(array('layout' => 'shared/layouts/simple.tpl', 'page' => 'lostpassword.tpl', 'page_message' => 'layout')); $tpl->assign(array('TR_PAGE_TITLE' => tr('i-MSCP - Multi Server Control Panel / Lost Password'), 'CONTEXT_CLASS' => '', 'productLongName' => tr('internet Multi Server Control Panel'), 'productLink' => 'http://www.i-mscp.net', 'productCopyright' => tr('© 2010-2015 i-MSCP Team<br/>All Rights Reserved'), 'TR_CAPCODE' => tr('Security code'), 'GET_NEW_IMAGE' => tr('Get a new image'), 'TR_IMGCAPCODE' => '<img id="captcha" src="imagecode.php" width="' . $cfg['LOSTPASSWORD_CAPTCHA_WIDTH'] . '" height="' . $cfg['LOSTPASSWORD_CAPTCHA_HEIGHT'] . '" alt="captcha image" />', 'TR_USERNAME' => tr('Username'), 'TR_SEND' => tr('Send'), 'TR_CANCEL' => tr('Cancel'))); // A request for new password was validated ( User clicked on the link he has received by mail ) if (isset($_GET['key']) && $_GET['key'] != '') { // Check key clean_input($_GET['key']); // Sending new password if (sendPassword($_GET['key'])) { set_page_message(tr('Your new password has been sent. Check your email.'), 'success'); redirectTo('index.php'); } else { set_page_message(tr('New password has not been sent. Ask your administrator.'), 'error'); } } elseif (!empty($_POST)) {