Skip to content
This repository has been archived by the owner on Jul 24, 2023. It is now read-only.

Commit

Permalink
Added getBadPasswordTimestamp and getBadPasswordDate methods
Browse files Browse the repository at this point in the history
  • Loading branch information
stevebauman committed Apr 1, 2019
1 parent 4fd6287 commit 8ce5f62
Showing 1 changed file with 33 additions and 7 deletions.
40 changes: 33 additions & 7 deletions src/Models/User.php
Expand Up @@ -362,19 +362,41 @@ public function getBadPasswordTime()
}

/**
* Returns the formatted timestamp of the password last set date.
* Returns the bad password time unix timestamp.
*
* @return float|null
*/
public function getBadPasswordTimestamp()
{
if ($time = $this->getBadPasswordTime()) {
return Utilities::convertWindowsTimeToUnixTime($time);
}
}

/**
* Returns the formatted timestamp of the bad password date.
*
* @return string|null
*
* @throws \Exception
*/
public function getPasswordLastSetDate()
public function getBadPasswordDate()
{
if ($timestamp = $this->getPasswordLastSetTimestamp()) {
if ($timestamp = $this->getBadPasswordTimestamp()) {
return (new DateTime())->setTimestamp($timestamp)->format($this->dateFormat);
}
}

/**
* Returns the time when the users password was set last.
*
* @return string
*/
public function getPasswordLastSet()
{
return $this->getFirstAttribute($this->schema->passwordLastSet());
}

/**
* Returns the password last set unix timestamp.
*
Expand All @@ -388,13 +410,17 @@ public function getPasswordLastSetTimestamp()
}

/**
* Returns the time when the users password was set last.
* Returns the formatted timestamp of the password last set date.
*
* @return string
* @return string|null
*
* @throws \Exception
*/
public function getPasswordLastSet()
public function getPasswordLastSetDate()
{
return $this->getFirstAttribute($this->schema->passwordLastSet());
if ($timestamp = $this->getPasswordLastSetTimestamp()) {
return (new DateTime())->setTimestamp($timestamp)->format($this->dateFormat);
}
}

/**
Expand Down

0 comments on commit 8ce5f62

Please sign in to comment.