Improve 2 factor usage
This commit is contained in:
parent
f3de8d7764
commit
0223c030a9
20 changed files with 400 additions and 77 deletions
|
@ -27,7 +27,7 @@ use Friendica\Util\Strings;
|
|||
|
||||
class TrustedBrowser extends BaseFactory
|
||||
{
|
||||
public function createForUserWithUserAgent($uid, $userAgent): \Friendica\Security\TwoFactor\Model\TrustedBrowser
|
||||
public function createForUserWithUserAgent(int $uid, string $userAgent, bool $trusted): \Friendica\Security\TwoFactor\Model\TrustedBrowser
|
||||
{
|
||||
$trustedHash = Strings::getRandomHex();
|
||||
|
||||
|
@ -35,6 +35,7 @@ class TrustedBrowser extends BaseFactory
|
|||
$trustedHash,
|
||||
$uid,
|
||||
$userAgent,
|
||||
$trusted,
|
||||
DateTimeFormat::utcNow()
|
||||
);
|
||||
}
|
||||
|
@ -45,6 +46,7 @@ class TrustedBrowser extends BaseFactory
|
|||
$row['cookie_hash'],
|
||||
$row['uid'],
|
||||
$row['user_agent'],
|
||||
$row['trusted'],
|
||||
$row['created'],
|
||||
$row['last_used']
|
||||
);
|
||||
|
|
|
@ -31,6 +31,7 @@ use Friendica\Util\DateTimeFormat;
|
|||
* @property-read $cookie_hash
|
||||
* @property-read $uid
|
||||
* @property-read $user_agent
|
||||
* @property-read $trusted
|
||||
* @property-read $created
|
||||
* @property-read $last_used
|
||||
* @package Friendica\Model\TwoFactor
|
||||
|
@ -40,6 +41,7 @@ class TrustedBrowser extends BaseEntity
|
|||
protected $cookie_hash;
|
||||
protected $uid;
|
||||
protected $user_agent;
|
||||
protected $trusted;
|
||||
protected $created;
|
||||
protected $last_used;
|
||||
|
||||
|
@ -51,16 +53,18 @@ class TrustedBrowser extends BaseEntity
|
|||
* @param string $cookie_hash
|
||||
* @param int $uid
|
||||
* @param string $user_agent
|
||||
* @param bool $trusted
|
||||
* @param string $created
|
||||
* @param string|null $last_used
|
||||
*/
|
||||
public function __construct(string $cookie_hash, int $uid, string $user_agent, string $created, string $last_used = null)
|
||||
public function __construct(string $cookie_hash, int $uid, string $user_agent, bool $trusted, string $created, string $last_used = null)
|
||||
{
|
||||
$this->cookie_hash = $cookie_hash;
|
||||
$this->uid = $uid;
|
||||
$this->user_agent = $user_agent;
|
||||
$this->created = $created;
|
||||
$this->last_used = $last_used;
|
||||
$this->uid = $uid;
|
||||
$this->user_agent = $user_agent;
|
||||
$this->trusted = $trusted;
|
||||
$this->created = $created;
|
||||
$this->last_used = $last_used;
|
||||
}
|
||||
|
||||
public function recordUse()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue