Skip to content

Commit

Permalink
Add formatting for LastUsed date
Browse files Browse the repository at this point in the history
  • Loading branch information
jesscostello committed Mar 24, 2022
1 parent 36a2e37 commit d521c1c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/MemberApiKey.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
use LogicException;
use SilverStripe\Core\Config\Config;
use SilverStripe\ORM\DataObject;
use SilverStripe\Security\Member;
use SilverStripe\ORM\FieldType\DBDatetime;
use SilverStripe\Security\Member;

class MemberApiKey extends DataObject
{
Expand All @@ -20,7 +20,7 @@ class MemberApiKey extends DataObject
];

private static $indexes = [
'ApiKeyIdx' => ['type' => 'unique', 'columns' => ['ApiKey'] ],
'ApiKeyIdx' => ['type' => 'unique', 'columns' => ['ApiKey']],
];

private static $has_one = [
Expand Down Expand Up @@ -90,7 +90,7 @@ public static function findByKey($key)
*/
public function markUsed()
{
$this->LastUsed = DBDatetime::now();
$this->LastUsed = DBDatetime::now()->Rfc2822();
$this->TimesUsed++;
$this->write();
}
Expand All @@ -105,7 +105,7 @@ protected static function randKey()
$keyLength = Config::inst()->get(self::class, 'key_length');

for ($i = 0; $i < $keyLength; $i++) {
$key .= $src[rand(0, strlen($src)-1)];
$key .= $src[rand(0, strlen($src) - 1)];
}

return $key;
Expand Down

0 comments on commit d521c1c

Please sign in to comment.