mirror of
https://github.com/HDInnovations/UNIT3D-Community-Edition.git
synced 2026-02-20 11:49:31 -06:00
46 lines
1.2 KiB
PHP
46 lines
1.2 KiB
PHP
<?php
|
|
/**
|
|
* NOTICE OF LICENSE.
|
|
*
|
|
* UNIT3D Community Edition is open-sourced software licensed under the GNU Affero General Public License v3.0
|
|
* The details is bundled with this project in the file LICENSE.txt.
|
|
*
|
|
* @project UNIT3D Community Edition
|
|
*
|
|
* @author HDVinnie <hdinnovations@protonmail.com>
|
|
* @license https://www.gnu.org/licenses/agpl-3.0.en.html/ GNU Affero General Public License v3.0
|
|
*/
|
|
|
|
namespace App\Providers;
|
|
|
|
use App\Helpers\CacheUser;
|
|
use App\Models\User;
|
|
use Illuminate\Auth\EloquentUserProvider;
|
|
use Illuminate\Contracts\Hashing\Hasher as HasherContract;
|
|
|
|
class CacheUserProvider extends EloquentUserProvider
|
|
{
|
|
public function __construct(HasherContract $hasher)
|
|
{
|
|
parent::__construct($hasher, User::class);
|
|
}
|
|
|
|
public function retrieveById($identifier)
|
|
{
|
|
return CacheUser::user($identifier);
|
|
}
|
|
|
|
public function retrieveByToken($identifier, $token)
|
|
{
|
|
$model = CacheUser::user($identifier);
|
|
|
|
if (! $model) {
|
|
return;
|
|
}
|
|
|
|
$rememberToken = $model->getRememberToken();
|
|
|
|
return $rememberToken && hash_equals($rememberToken, $token) ? $model : null;
|
|
}
|
|
}
|