Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[12.x] modernize DatabaseTokenRepository and make consistent with CacheTokenRepository #53746

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 6 additions & 62 deletions src/Illuminate/Auth/Passwords/DatabaseTokenRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,73 +10,17 @@

class DatabaseTokenRepository implements TokenRepositoryInterface
{
/**
* The database connection instance.
*
* @var \Illuminate\Database\ConnectionInterface
*/
protected $connection;

/**
* The Hasher implementation.
*
* @var \Illuminate\Contracts\Hashing\Hasher
*/
protected $hasher;

/**
* The token database table.
*
* @var string
*/
protected $table;

/**
* The hashing key.
*
* @var string
*/
protected $hashKey;

/**
* The number of seconds a token should last.
*
* @var int
*/
protected $expires;

/**
* Minimum number of seconds before re-redefining the token.
*
* @var int
*/
protected $throttle;

/**
* Create a new token repository instance.
*
* @param \Illuminate\Database\ConnectionInterface $connection
* @param \Illuminate\Contracts\Hashing\Hasher $hasher
* @param string $table
* @param string $hashKey
* @param int $expires
* @param int $throttle
* @return void
*/
public function __construct(
ConnectionInterface $connection,
HasherContract $hasher,
$table,
$hashKey,
$expires = 60,
$throttle = 60,
protected ConnectionInterface $connection,
protected HasherContract $hasher,
protected string $table,
protected string $hashKey,
protected int $expires = 3600,
browner12 marked this conversation as resolved.
Show resolved Hide resolved
protected int $throttle = 60,
) {
$this->table = $table;
$this->hasher = $hasher;
$this->hashKey = $hashKey;
$this->expires = $expires * 60;
$this->connection = $connection;
$this->throttle = $throttle;
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/Illuminate/Auth/Passwords/PasswordBrokerManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ protected function createTokenRepository(array $config)
$this->app['hash'],
$config['table'],
$key,
$config['expire'],
$config['throttle'] ?? 0
($config['expire'] ?? 60) * 60,
$config['throttle'] ?? 0,
);
}

Expand Down
Loading