* @copyright PrestaShop * @license http://www.opensource.org/licenses/osl-3.0.php Open-source licence 3.0 * @version 1.2 * */ define('PS_ADMIN_DIR', getcwd()); include(PS_ADMIN_DIR.'/../config/config.inc.php'); include(PS_ADMIN_DIR.'/functions.php'); $errors = array(); $cookie = new Cookie('psAdmin', substr($_SERVER['PHP_SELF'], strlen(__PS_BASE_URI__), -10)); $id_lang = intval($cookie->id_lang) ? intval($cookie->id_lang) : 1; $iso = strtolower(Language::getIsoById($cookie->id_lang ? intval($cookie->id_lang) : 1)); 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 doesn\'t exist'); else { if (1==2) $errors[] = Tools::displayError('You can regenerate your password only each').' '.Configuration::get('PS_PASSWD_TIME_BACK').' '.Tools::displayError('minute(s)'); else { //$pwd = Tools::passwdGen(); $pwd = '12345678'; $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 { Mail::Send($id_lang, 'password', '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 '
'.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').'.
 
'; ?>