Merge branch 'ticket-13943-ResetBOpassword'

This commit is contained in:
Marion Muszynski 2017-09-21 15:40:57 +02:00
commit 4b985fb501
11 changed files with 582 additions and 3 deletions

View File

@ -206,6 +206,9 @@ class HelperFormBootstrap{
case 'simpleText':
$this->inputSimpleText($input);
break;
case 'textAddon':
$this->inputTextAddon($input);
break;
case 'tag':
$this->inputTag($input);
break;
@ -309,9 +312,10 @@ class HelperFormBootstrap{
'.(isset($p['label']) && $p['label'] ?'<label class="control-label '.$p['label-class'].'" for="'.(isset($p['id']) ? $p['id'] : $p['name']).'">'.$p['label'].'</label>':'').'
<div class="input-group input-group-sm">
'.(isset($p['before']) && $p['before'] ?'<div class="input-group-addon">'.$p['before'].'</div>':'').'
<input type="text" class="form-control" name="'.$p['name'].'" id="'.(isset($p['id']) ? $p['id'] : $p['name']).'" placeholder="'.((isset($p['placeholder']) && $p['placeholder'])?$p['placeholder']:'').'">
<input type="text" class="form-control" '.(isset($p['default']) && $p['default'] ? 'value="'.$p['default'].'"':'').' name="'.$p['name'].'" id="'.(isset($p['id']) ? $p['id'] : $p['name']).'" placeholder="'.((isset($p['placeholder']) && $p['placeholder'])?$p['placeholder']:'').'">
'.(isset($p['after']) && $p['after'] ?'<div class="input-group-addon">'.$p['after'].'</div>':'').'
</div>
' . ((isset($p['help']) && $p['help']) ? '<span class="help-block">'.$p['help'].'</span>' : '') . '
</div>';
}

View File

@ -392,6 +392,12 @@ table.table tr th {
.table tr td {
color: #000;
}
.table th a{
color:#fff;
}
.table tbody tr th:first-child span{
color: #E36EA2!important;
}
/* Select2 */
.select2-results ul li{

View File

@ -56,6 +56,11 @@ else
define('_PS_BASE_URL_SSL_', Tools::getShopDomainSsl(true));
$employee = new Employee((int)$cookie->id_employee);
/* @Override Antadis - safety reset passaword */
Module::hookExec('ant_initadmin', array('employee' => $employee));
/* @End Override Antadis - safety reset passaword */
$cookie->profile = $employee->id_profile;
$cookie->id_lang = (int)$employee->id_lang;
$iso = strtolower(Language::getIsoById($cookie->id_lang ? $cookie->id_lang : Configuration::get('PS_LANG_DEFAULT')));

219
adm/resetpasswd.php Normal file
View File

@ -0,0 +1,219 @@
<?php
/*
* 2007-2011 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2011 PrestaShop SA
* @version Release: $Revision: 9346 $
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
ob_start();
define('PS_ADMIN_DIR', getcwd());
include(PS_ADMIN_DIR.'/../config/config.inc.php');
include(PS_ADMIN_DIR.'/functions.php');
$clientIsMaintenanceOrLocal = in_array(Tools::getRemoteAddr(), array_merge(array('127.0.0.1'),explode(',', Configuration::get('PS_MAINTENANCE_IP'))));
$errors = array();
if ((empty($_SERVER['HTTPS']) OR strtolower($_SERVER['HTTPS']) == 'off')
AND Configuration::get('PS_SSL_ENABLED'))
{
// You can uncomment theses lines if you want to force https even from localhost and automatically redirect
// header('HTTP/1.1 301 Moved Permanently');
// header('Location: '.Tools::getShopDomainSsl(true).$_SERVER['REQUEST_URI']);
// exit();
// If ssl is enabled, https protocol is required. Exception for maintenance and local (127.0.0.1) IP
if ($clientIsMaintenanceOrLocal)
$errors[] = translate('SSL is activated. However, your IP is allowed to use unsecure mode (Maintenance or local IP).').'<br/>';
else
$warningSslMessage = translate('SSL is activated. Please connect using the following url to log in in secure mode (https).')
.'<br/><br/><a href="https://'.Tools::getServerName().Tools::safeOutput($_SERVER['REQUEST_URI']).'">https://'.Tools::getServerName().Tools::safeOutput($_SERVER['REQUEST_URI']).'</a>';
}
$timerStart = microtime(true);
$currentFileName = array_reverse(explode("/", $_SERVER['SCRIPT_NAME']));
$cookieLifetime = (time() + (((int)Configuration::get('PS_COOKIE_LIFETIME_BO') > 0 ? (int)Configuration::get('PS_COOKIE_LIFETIME_BO') : 1)* 3600));
$cookie = new Cookie('psAdmin', substr($_SERVER['SCRIPT_NAME'], strlen(__PS_BASE_URI__), -strlen($currentFileName['0'])), $cookieLifetime);
if (!isset($cookie->id_lang))
$cookie->id_lang = Configuration::get('PS_LANG_DEFAULT');
$iso = strtolower(Language::getIsoById((int)($cookie->id_lang)));
include(_PS_TRANSLATIONS_DIR_.$iso.'/admin.php');
include(_PS_TRANSLATIONS_DIR_.$iso.'/errors.php');
if($cookie->isLoggedBack){
$cookie->logout();
}
/* Cookie creation and redirection */
if (Tools::isSubmit('Submit'))
{
/* Check fields validity */
$passwd = trim(Tools::getValue('passwd'));
$passwd_conf = trim(Tools::getValue('passwd_conf'));
$email = trim(Tools::getValue('email'));
if (empty($email)) {
$errors[] = Tools::displayError('E-mail is empty');
}
elseif (!Validate::isEmail($email)) {
$errors[] = Tools::displayError('Invalid e-mail address');
}
elseif (empty($passwd) || empty($passwd_conf)) {
$errors[] = Tools::displayError('Password is blank');
}
elseif (!Validate::isPasswd($passwd) || !Validate::isPasswd($passwd_conf)) {
$errors[] = Tools::displayError('Invalid password');
}
elseif ($passwd!==$passwd_conf) {
$errors[] = Tools::displayError('Confirmation password different from password');
}
else
{
/* Seeking for employee */
$employee = new Employee();
$employee = $employee->getByemail($email);
if (!$employee)
{
$errors[] = Tools::displayError('Employee does not exist or password is incorrect.');
$cookie->logout();
}
else
{
$_employee = $employee->getByemail($email,$passwd);
if($_employee){
$errors[] = Tools::displayError('You have to change your password');
} else {
$employee->passwd = Tools::encrypt($passwd);
if($employee->update()){
/* Creating cookie */
$cookie->id_employee = $employee->id;
$cookie->email = $employee->email;
$cookie->profile = $employee->id_profile;
$cookie->passwd = $employee->passwd;
$cookie->remote_addr = ip2long(Tools::getRemoteAddr());
$cookie->write();
/* Redirect to admin panel */
if (isset($_GET['redirect']))
$url = strval($_GET['redirect'].(isset($_GET['token']) ? ('&token='.$_GET['token']) : ''));
else
$url = 'index.php';
if (!Validate::isCleanHtml($url)){
die(Tools::displayError());
}
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="'.$iso.'" lang="'.$iso.'">
<meta http-equiv="Refresh" content="0;URL='.str_replace('&amp;', '&', Tools::safeOutput($url, true)).'">
<head>
<script language="javascript" type="text/javascript">
window.location.replace("'.str_replace('&amp;', '&', Tools::safeOutput($url, true)).'");
</script>
<div style="text-align:center; margin-top:250px;"><a href="'.str_replace('&amp;', '&', Tools::safeOutput($url, true)).'">'.translate('Click here to launch Administration panel').'</a></div>
</head>
</html>';
exit ;
} else {
$errors[] = Tools::displayError('An error occured during the updating');
}
}
}
}
}
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="'.$iso.'" lang="'.$iso.'">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link type="text/css" rel="stylesheet" href="../css/login.css" />
<title>PrestaShop&trade; - '.translate('Administration panel').'</title>';
echo '
</head>
<body>
<div id="container">';
if ($nbErrors = sizeof($errors))
{
echo '
<div id="error">
<h3>'.($nbErrors > 1 ? translate('There are') : translate('There is')).' '.$nbErrors.' '.($nbErrors > 1 ? translate('errors') : translate('error')).'</h3>
<ol style="margin: 0 0 0 20px;">';
foreach ($errors AS $error)
echo '<li>'.$error.'</li>';
echo '
</ol>
</div>
<br />';
}
echo '
<div id="login">
<h1>'.Tools::htmlentitiesUTF8(Configuration::get('PS_SHOP_NAME')).'</h1>
<p style="text-align:center; margin:0;">'.translate('It\'s time to change your password').'</p>
<form action="'.Tools::htmlentitiesUTF8($_SERVER['REQUEST_URI']).'" method="post">';
$randomNb = rand(100, 999);
if (file_exists(PS_ADMIN_DIR.'/../install') OR file_exists(PS_ADMIN_DIR.'/../admin'))
{
echo ' <span>'.translate('For security reasons, you cannot connect to the Back Office until after you have:').'<br /><br />
- '.translate('delete the /install folder').'<br />
- '.translate('renamed the /admin folder (eg. ').'/admin'.$randomNb.')<br />
<br />'.translate('Please then access this page by the new url (eg. http://www.domain.tld/admin').$randomNb.')</span>';
}
else
{
// If https enabled, we force it except if you try to log in from maintenance or local ip
if ( (empty($_SERVER['HTTPS']) OR strtolower($_SERVER['HTTPS']) == 'off')
AND ( Configuration::get('PS_SSL_ENABLED') AND !$clientIsMaintenanceOrLocal)
)
echo '<div class="error">'.$warningSslMessage.'</div>';
else
echo '<label for="email">'.translate('E-mail address:').'</label>
<br />
<input type="text" id="email" name="email" value="'.Tools::safeOutput(Tools::getValue('email')).'" class="input"/>
<div style="margin: 1.8em 0 0 0;">
<label for="passwd">'.translate('New Password:').'</label><br />
<input id="passwd" type="password" name="passwd" class="input" value=""/>
</div>
<div style="margin: 1.8em 0 0 0;">
<label for="passwd_conf">'.translate('Password Conf:').'</label><br />
<input id="passwd_conf" type="password" name="passwd_conf" class="input" value=""/>
</div>
<div>
<div id="submit"><input type="submit" name="Submit" value="'.translate('Update').'" class="button" /></div>
</div>
';
}
?>
<script type="text/javascript">
//<![CDATA[
if (document.getElementById('email')) document.getElementById('email').focus();
//]]>
</script>
<?php
echo '
</form>
</div>
<h2><a href="http://www.prestashop.com">&copy; Copyright by PrestaShop. all rights reserved.</a></h2>
</div>
</body>
</html>';

View File

@ -0,0 +1,42 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Message de {shop_name}</title>
</head>
<body>
<table style="font-family: tahoma,arial,sans-serif; font-size: 12px; color:#000000; width: 550px;">
<tr>
<td align="left">
<a href="{shop_url}" title="{shop_name}"><img alt="{shop_name}" src="{shop_logo}" style="border:none;" ></a>
</td>
</tr>
<tr><td>&nbsp;</td></tr>
<tr>
<td align="left">Bonjour <strong>{employee}</strong>,</td>
</tr>
<tr><td>&nbsp;</td></tr>
<tr>
<td align="left" style="background: #514c8c; color:#ffffff; font-size: 12px; font-weight:bold; padding: 0.5em 1em;">Il est temps de changer votre mot de passe d'acc&egrave;s au BO</td>
</tr>
<tr><td>&nbsp;</td></tr>
<tr>
<td align="left">
Pour changer votre mot de passe il suffit d'aller dans "Mes pr&eacute;f&eacute;rences" dans le panneau d'administration de B&eacute;b&eacute;boutik.
</td>
</tr>
<tr><td>&nbsp;</td></tr>
<tr>
<td align="left">
Vous avez {limit} jours pour changer votre mot de passe.
</td>
</tr>
<tr><td>&nbsp;</td></tr>
<tr>
<td align="center" style="font-size: 12px; border-top: 1px solid #cccccc; padding-top: 5px;">
{shop_name} - <a href="{shop_url}" style="color: #e26ea2;">{shop_url}</a>
</td>
</tr>
</table>
</body>
</html>

View File

@ -0,0 +1,7 @@
Il est temps de changer votre mot de passe d'accès au BO
Pour changer votre mot de passe il suffit d'aller dans "Mes préférences" dans le panneau d'administration de Bébéboutik.
Vous avez {limit} jours pour changer votre mot de passe.
{shop_name} - {shop_url}

View File

@ -0,0 +1,42 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Message de {shop_name}</title>
</head>
<body>
<table style="font-family: tahoma,arial,sans-serif; font-size: 12px; color:#000000; width: 550px;">
<tr>
<td align="left">
<a href="{shop_url}" title="{shop_name}"><img alt="{shop_name}" src="{shop_logo}" style="border:none;" ></a>
</td>
</tr>
<tr><td>&nbsp;</td></tr>
<tr>
<td align="left">Bonjour <strong>{employee}</strong>,</td>
</tr>
<tr><td>&nbsp;</td></tr>
<tr>
<td align="left" style="background: #514c8c; color:#ffffff; font-size: 12px; font-weight:bold; padding: 0.5em 1em;">Il est temps de changer votre mot de passe d'acc&egrave;s au BO</td>
</tr>
<tr><td>&nbsp;</td></tr>
<tr>
<td align="left">
Vous ne pourrez plus acc&eacute;der au panneau d'administration de B&eacute;b&eacute;boutik tant que vous n'aurez pas modifi&eacute; votre mot de passe.
</td>
</tr>
<tr><td>&nbsp;</td></tr>
<tr>
<td align="left">
Veuillez r&eacute;initialiser votre mot de passe à l'adresse suivante <a href="{shop_url}" style="color: #e26ea2;">{reset_link}</a>
</td>
</tr>
<tr><td>&nbsp;</td></tr>
<tr>
<td align="center" style="font-size: 12px; border-top: 1px solid #cccccc; padding-top: 5px;">
{shop_name} - <a href="{shop_url}" style="color: #e26ea2;">{shop_url}</a>
</td>
</tr>
</table>
</body>
</html>

View File

@ -0,0 +1,7 @@
Il est temps de changer votre mot de passe d'accès au BO
Sans cela vous ne pourrez plus accéder au panneau d'administration de Bébéboutik.
Suivez le lien {reset_link}
{shop_name} - {shop_url}

View File

@ -0,0 +1,136 @@
<?php
if (!defined('_PS_VERSION_'))
exit;
require_once(PS_ADMIN_DIR . '/helpers/HelperFormBootstrap.php');
class Ant_Resetbopassword extends Module
{
public $_html = '';
public function __construct()
{
$this->name = 'ant_resetbopassword';
$this->tab = 'administration';
$this->author = 'Antadis';
$this->version = '1.0';
$this->need_instance = 0;
parent::__construct();
$this->displayName = $this->l('Sécurité BO');
$this->description = $this->l('Envoi, tous les X mois, une demande de changement de mot de passe aux employés');
}
public function install()
{
if(!(parent::install())) {
return false;
}
Db::getInstance()->execute('ALTER TABLE `'._DB_PREFIX_.'employee` ADD `date_passwd_upd` DATETIME DEFAULT "'.pSQL(date("Y-m-d H:i:s")).'"');
# Set default configuration values
Configuration::updateValue('ANT_RESETBOPASSWORD_FREQ', 3); // month
Configuration::updateValue('ANT_RESETBOPASSWORD_LIMIT', 7); // day
Configuration::updateValue('ANT_RESETBOPASSWORD_DATE', date('Y-m-d H:i:s')); // last date of updating
return true;
}
public function uninstall()
{
if(parent::uninstall() == false) {
return false;
}
Configuration::deleteByName('ANT_RESETBOPASSWORD_FREQ');
Configuration::deleteByName('ANT_RESETBOPASSWORD_LIMIT');
Configuration::deleteByName('ANT_RESETBOPASSWORD_DATE');
return true;
}
public function getContent()
{
global $cookie, $currentIndex;
if(Tools::isSubmit('submitUpdate')) {
Configuration::updateValue('ANT_RESETBOPASSWORD_FREQ', Tools::getValue('frequency'));
Configuration::updateValue('ANT_RESETBOPASSWORD_LIMIT', Tools::getValue('limit'));
}
$helper = new HelperFormBootstrap();
$this->_html .= $helper->renderStyle();
$this->_html .= '
<div class="row">
<div class="col-md-12">
<div class="panel">
<div class="panel-title">
<h2 style="font-size:24px;"><span class="anticon anticon-cog text-rose" style="font-size:24px;"></span> '.$this->l('Reset Bo Password - Configurations').'</h2>
<div class="clearfix"></div>
</div>
<div class="panel-content">
<form method="POST" action="">
<div class="col-sm-3 col-sm-offset-4">';
$input = array(
'type' => 'textAddon',
'label' => $this->l('Frequency :'),
'lang' => true,
'name' => 'frequency',
'id' => 'frequency',
'required' => true,
'after' => $this->l('Months'),
'help' => $this->l('Mail sending frequency'),
'default' => Configuration::get('ANT_RESETBOPASSWORD_FREQ')
);
$this->_html .= $helper->generateInput($input);
$this->_html .= '<div class="clearfix"></div>';
$input = array(
'type' => 'textAddon',
'label' => $this->l('Limit :'),
'lang' => true,
'name' => 'limit',
'id' => 'limit',
'required' => true,
'after' => $this->l('Days'),
'help' => $this->l('Nb of day limited to change the password'),
'default' => Configuration::get('ANT_RESETBOPASSWORD_LIMIT')
);
$this->_html .= $helper->generateInput($input);
$this->_html .= '<div class="clearfix"></div>';
$this->_html .='
</div>
<div class="clear"></div>
<div class="ln_solid-small"></div>
<div class="text-right">
<input type="submit" class="btn btn-primary" name="submitUpdate" value="'.$this->l('Save').'" />
</div>
</form>
</div>
</div>
</div>
</div>';
$this->_html .= $helper->renderScript();
return $this->_html;
}
public function hookAnt_Initadmin($params)
{
$now = new Datetime("now");
$date_passwd_upd = new Datetime($params['employee']->date_passwd_upd);
$updated_date_send = new Datetime(Configuration::get('ANT_RESETBOPASSWORD_DATE'));
$limit = (int)Configuration::get('ANT_RESETBOPASSWORD_LIMIT');
$limit_day = $day_limit = $limit>1?$limit.' days':'1 day';
$date_send = $updated_date_send;
$date_send->modify("+".$limit_day."");
$now->modify("-".$limit_day."");
if($now > $date_send && $date_passwd_upd < $updated_date_send){
$destination = substr($_SERVER['REQUEST_URI'], strlen(dirname($_SERVER['SCRIPT_NAME'])) + 1);
Tools::redirectAdmin('resetpasswd.php'.(empty($destination) || ($destination == 'index.php?logout') ? '' : '?redirect='.$destination));
}
return true;
}
}

View File

@ -0,0 +1,66 @@
<?php
if(isset($_SERVER['REMOTE_ADDR'])) exit;
$_SERVER['SERVER_PORT'] = 80;
$_SERVER['HTTP_HOST'] = 'www.bebeboutik.com';
include(dirname(__FILE__).'/../../config/config.inc.php');
include dirname(__FILE__).'/../../init.php';
$sending_date = Configuration::get('ANT_RESETBOPASSWORD_DATE');
$frequency = Configuration::get('ANT_RESETBOPASSWORD_FREQ');
$limit = Configuration::get('ANT_RESETBOPASSWORD_LIMIT');
// First sending
$now = new Datetime("now");
$last_sent = new Datetime($sending_date);
$intervale = (int)$frequency>1?'+'.$frequency.' months':'+1 month';
$last_sent->modify($intervale);
if($now >= $last_sent){
$employees = Db::getInstance()->ExecuteS('
SELECT `id_employee`, CONCAT(`firstname`, \' \', `lastname`) AS "name", email
FROM `'._DB_PREFIX_.'employee`
WHERE `active` = 1
ORDER BY `email`
');
foreach ($employees as $key => $employee) {
$data = array(
'{limit}' => (int)$limit,
'{employee}' => $employee['name'],
);
Mail::Send(2, 'resetpassword', 'Sécurité Prestashop', $data, $employee['email']);
}
Configuration::updateValue('ANT_RESETBOPASSWORD_DATE', date('Y-m-d H:i:s'));
}
// Resending !
$reset_link = __PS_BASE_URI__.'adm/resetpasswd.php';
$updated_date_send = new Datetime(Configuration::get('ANT_RESETBOPASSWORD_DATE'));
$sending_date = $updated_date_send;
$day_limit = $limit>1?'+'.$limit.' days':'+1 day';
$updated_date_send->modify($day_limit);
$employees = Db::getInstance()->ExecuteS('
SELECT `id_employee`, CONCAT(`firstname`, \' \', `lastname`) AS "name", `email`, `date_passwd_upd`
FROM `'._DB_PREFIX_.'employee`
WHERE `active` = 1 AND
ORDER BY `email`
');
foreach ($employees as $key => $employee) {
$date_passwd_upd = new Datetime($employee['date_passwd_upd']);
if($now > $updated_date_send && $date_passwd_upd < $sending_date){
$data = array(
'{limit}' => (int)$limit,
'{employee}' => $employee['name'],
'{reset_link}' => $reset_link,
);
Mail::Send(2, 'resetpassword_2', 'Sécurité Prestashop', $data, $employee['email']);
}
}
exit;

View File

@ -1,6 +1,37 @@
<?php
class Employee extends EmployeeCore {
public $date_passwd_upd;
public function getFields()
{
parent::validateFields();
$fields['id_profile'] = (int)$this->id_profile;
$fields['id_lang'] = (int)$this->id_lang;
$fields['lastname'] = pSQL($this->lastname);
$fields['firstname'] = pSQL(Tools::ucfirst($this->firstname));
$fields['email'] = pSQL($this->email);
$fields['passwd'] = pSQL($this->passwd);
$fields['last_passwd_gen'] = pSQL($this->last_passwd_gen);
$fields['date_passwd_upd'] = pSQL($this->date_passwd_upd);
if (empty($this->stats_date_from))
$this->stats_date_from = date('Y-m-d 00:00:00');
$fields['stats_date_from'] = pSQL($this->stats_date_from);
if (empty($this->stats_date_to))
$this->stats_date_to = date('Y-m-d 23:59:59');
$fields['stats_date_to'] = pSQL($this->stats_date_to);
$fields['bo_color'] = pSQL($this->bo_color);
$fields['bo_theme'] = pSQL($this->bo_theme);
$fields['bo_uimode'] = pSQL($this->bo_uimode);
$fields['bo_show_screencast'] = (int)$this->bo_show_screencast;
$fields['active'] = (int)$this->active;
return $fields;
}
public static function getEmployeesByProfile($id_profiles=array())
{
@ -12,4 +43,18 @@ class Employee extends EmployeeCore {
ORDER BY `email`');
}
public function update($nullValues = false)
{
$result = parent::update($nullValues);
if(isset($_POST['passwd']) && $_POST['passwd']!==null && $result){
Db::getInstance()->ExecuteS('
UPDATE `'._DB_PREFIX_.'employee`
SET `date_passwd_upd` = "'.pSQL(date('Y-m-d H:i:s')).'"
WHERE `id_employee` = '.(int)$this->id.'
');
}
return $result;
}
}