* @copyright 2007-2011 PrestaShop SA * @version Release: $Revision: 7541 $ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ define('PS_ADMIN_DIR', getcwd()); include(PS_ADMIN_DIR.'/../config/config.inc.php'); include(PS_ADMIN_DIR.'/functions.php'); $cookie = new Cookie('psAdmin', substr($_SERVER['PHP_SELF'], strlen(__PS_BASE_URI__), -10)); $errors = array(); $id_lang = (int)Configuration::get('PS_LANG_DEFAULT'); $iso = strtolower(Language::getIsoById((int)$id_lang)); include(_PS_TRANSLATIONS_DIR_.$iso.'/admin.php'); if (isset($_POST['Submit'])) { $errors = array(); if (empty($_POST['email'])) $errors[] = Tools::displayError('E-mail is empty'); elseif (!Validate::isEmail($_POST['email'])) $errors[] = Tools::displayError('Invalid e-mail address'); else { $employee = new Employee(); if (!$employee->getByemail($_POST['email']) OR !$employee) $errors[] = Tools::displayError('This account does not exist'); else { if ((strtotime($employee->last_passwd_gen.'+'.Configuration::get('PS_PASSWD_TIME_BACK').' minutes') - time()) > 0 ) $errors[] = Tools::displayError('You can regenerate your password only every').' '.Configuration::get('PS_PASSWD_TIME_BACK').' '.Tools::displayError('minute(s)'); else { $pwd = Tools::passwdGen(); $employee->passwd = md5(pSQL(_COOKIE_KEY_.$pwd)); $employee->last_passwd_gen = date('Y-m-d H:i:s', time()); $result = $employee->update(); if (!$result) $errors[] = Tools::displayError('An error occurred during your password change.'); else { if (Mail::Send((int)$id_lang, 'password', Mail::l('Your new admin password'), array('{email}' => $employee->email, '{lastname}' => $employee->lastname, '{firstname}' => $employee->firstname, '{passwd}' => $pwd), $employee->email, $employee->firstname.' '.$employee->lastname)) $confirmation = 'ok'; } } } } } echo ' PrestaShop™ - '.translate('Administration panel').'
'; if (sizeof($errors)) { echo '

'.translate('There is 1 error').'

    '; foreach ($errors AS $error) echo '
  1. '.$error.'
  2. '; echo '
'; } echo '

'.Configuration::get('PS_SHOP_NAME').'

'.translate('Forgot your password?').'

'; if (isset($confirmation)) echo '
'.translate('Your password has been e-mailed to you').'.
> '.translate('back to login home').'
'; else echo ' '.translate('Please, enter your e-mail address').' '.translate('(the one you wrote during your registration) in order to receive your access codes by e-mail').'.
 

© Copyright by PrestaShop. all rights reserved.

';