mirror of
https://github.com/NNTmux/newznab-tmux.git
synced 2026-08-29 00:01:21 +00:00
CS fixes
This commit is contained in:
@@ -161,7 +161,7 @@ class PasswordSecurityController extends Controller
|
||||
// If the user has checked "trust this device", create a trust token
|
||||
if ($request->has('trust_device') && $request->input('trust_device') == 1) {
|
||||
// Generate a unique token for this device
|
||||
$token = hash('sha256', $user->id . uniqid() . time());
|
||||
$token = hash('sha256', $user->id.uniqid().time());
|
||||
|
||||
// Store the token with an expiry time of 30 days
|
||||
$expiresAt = now()->addDays(30)->timestamp;
|
||||
@@ -172,7 +172,7 @@ class PasswordSecurityController extends Controller
|
||||
json_encode([
|
||||
'user_id' => $user->id,
|
||||
'token' => $token,
|
||||
'expires_at' => $expiresAt
|
||||
'expires_at' => $expiresAt,
|
||||
]),
|
||||
60 * 24 * 30 // 30 days in minutes
|
||||
);
|
||||
|
||||
@@ -23,14 +23,12 @@ class Google2FAAuthenticator extends Authenticator
|
||||
|
||||
/**
|
||||
* Check if current device is trusted
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function isDeviceTrusted(): bool
|
||||
{
|
||||
$cookie = request()->cookie('2fa_trusted_device');
|
||||
|
||||
if (!$cookie) {
|
||||
if (! $cookie) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -38,12 +36,12 @@ class Google2FAAuthenticator extends Authenticator
|
||||
$data = json_decode($cookie, true);
|
||||
|
||||
// Check if cookie contains the required data
|
||||
if (!isset($data['user_id'], $data['token'], $data['expires_at'])) {
|
||||
if (! isset($data['user_id'], $data['token'], $data['expires_at'])) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check if the token belongs to the current user
|
||||
if ((int)$data['user_id'] !== (int)$this->getUser()->id) {
|
||||
if ((int) $data['user_id'] !== (int) $this->getUser()->id) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user