[L6] Update cache methods to use defined times and not ints

This commit is contained in:
Dane Everitt 2019-09-04 20:24:46 -07:00
parent 2c0503c593
commit bd8b708c32
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
4 changed files with 8 additions and 4 deletions

View file

@ -10,6 +10,7 @@
namespace Pterodactyl\Http\Controllers\Admin;
use Javascript;
use Cake\Chronos\Chronos;
use Illuminate\Http\Request;
use Pterodactyl\Models\Node;
use Illuminate\Http\Response;
@ -396,7 +397,7 @@ class NodesController extends Controller
public function setToken(Node $node)
{
$token = bin2hex(random_bytes(16));
$this->cache->put('Node:Configuration:' . $token, $node->id, 5);
$this->cache->put('Node:Configuration:' . $token, $node->id, Chronos::now()->addMinutes(5));
return response()->json(['token' => $token]);
}

View file

@ -2,6 +2,7 @@
namespace Pterodactyl\Http\Controllers\Auth;
use Cake\Chronos\Chronos;
use Illuminate\Support\Str;
use Illuminate\Http\Request;
use Illuminate\Auth\AuthManager;
@ -100,7 +101,7 @@ class LoginController extends AbstractLoginController
if ($user->use_totp) {
$token = Str::random(64);
$this->cache->put($token, $user->id, 5);
$this->cache->put($token, $user->id, Chronos::now()->addMinutes(5));
return JsonResponse::create([
'data' => [