2
0
forked from Wavyzz/dolibarr

NEW Show IP of previous connexion and date of last password change in

the "Connexion" widget.
This commit is contained in:
ldestailleur
2025-03-27 18:12:26 +01:00
parent 0e6f6ca1f8
commit 8e23f51959
3 changed files with 28 additions and 5 deletions

View File

@@ -289,6 +289,10 @@ class User extends CommonObject
public $clicktodial_loaded;
/**
* @var int|string
*/
public $datelastpassvalidation;
/**
* @var int|string
*/
@@ -662,6 +666,7 @@ class User extends CommonObject
$this->pass_indatabase_crypted = $obj->pass_crypted;
$this->pass = $obj->pass;
$this->pass_temp = $obj->pass_temp;
$this->datelastpassvalidation = $obj->datelastpassvalidation;
$this->api_key = dolDecrypt($obj->api_key);
$this->address = $obj->address;
@@ -2550,6 +2555,7 @@ class User extends CommonObject
$sql = "UPDATE ".$this->db->prefix()."user";
$sql .= " SET pass_crypted = '".$this->db->escape($password_crypted)."',";
$sql .= " datelastpassvalidation = '".$this->db->idate(dol_now())."',";
$sql .= " pass_temp = null";
if (!empty($flagdelsessionsbefore)) {
$sql .= ", flagdelsessionsbefore = '".$this->db->idate($now - 5, 'gmt')."'";
@@ -2562,6 +2568,7 @@ class User extends CommonObject
$sql .= " WHERE rowid = ".((int) $this->id);
dol_syslog(get_class($this)."::setPassword", LOG_DEBUG);
$result = $this->db->query($sql);
if ($result) {
if ($this->db->affected_rows($result)) {