fix tests to pass

This commit is contained in:
Sky Mulley
2026-10-08 09:54:19 +01:00
parent 964e7c7647
commit ff9527a2e9
7 changed files with 24 additions and 26 deletions
@@ -114,9 +114,7 @@ class ResetPasswordController extends Controller
if (! $user->use_totp) {
Auth::guard()->login($user);
if (method_exists(Auth::guard(), 'logoutOtherDevices')) {
Auth::guard()->logoutOtherDevices($password);
}
Auth::guard()->logoutOtherDevices($password);
}
$this->hasTwoFactor = $user->use_totp;
@@ -6,7 +6,6 @@ namespace Pterodactyl\Http\Middleware\Api;
use Closure;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Log;
use InvalidArgumentException;
use IPTools\Exception\IpException;
use IPTools\Exception\NetworkException;
@@ -62,7 +61,7 @@ class AuthenticateIPAccess
if (Range::parse($ip)->contains($find)) {
return $next($request);
}
} catch (IpException | NetworkException | InvalidArgumentException $exception) {
} catch (IpException|NetworkException|InvalidArgumentException) {
// Ignore the error entirely
continue;
}
+1 -2
View File
@@ -12,7 +12,6 @@ use Illuminate\Contracts\Events\Dispatcher;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Illuminate\Support\Arr;
use Illuminate\Support\Facades\Log;
use Pterodactyl\Events\Auth\FailedCaptcha;
use Pterodactyl\Support\JsonValueGuard;
use Symfony\Component\HttpKernel\Exception\HttpException;
@@ -76,7 +75,7 @@ class VerifyReCaptcha
if ($res->getStatusCode() === 200) {
return $this->decodeResponse($res->getBody()->__toString());
}
} catch (GuzzleException $exception) {
} catch (GuzzleException) {
// Ignore the error entirely, we will just return a failed response below.
}
@@ -52,7 +52,7 @@ class StoreApiKeyRequest extends ClientApiRequest
$valid = false;
try {
$valid = Range::parse($ip)->valid();
} catch (IpException | NetworkException | InvalidArgumentException) {
} catch (IpException|NetworkException|InvalidArgumentException) {
$valid = false;
}
+5 -3
View File
@@ -6,6 +6,7 @@ namespace Pterodactyl\Listeners;
use Illuminate\Contracts\Events\Dispatcher;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Query\Builder;
use Illuminate\Foundation\Bus\PendingDispatch;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Str;
@@ -14,6 +15,7 @@ use Pterodactyl\Events\User\PasswordChanged;
use Pterodactyl\Extensions\Illuminate\Events\Contracts\SubscribesToEvents;
use Pterodactyl\Jobs\RevokeSftpAccessJob;
use Pterodactyl\Models\Node;
use Pterodactyl\Support\JsonValueGuard;
class RevocationListener implements SubscribesToEvents
{
@@ -26,13 +28,13 @@ class RevocationListener implements SubscribesToEvents
])->saveQuietly();
if (config('session.driver') === 'database') {
$table = config('session.table', 'sessions');
if (is_string($table) && $table !== '') {
$table = JsonValueGuard::string(config('session.table', 'sessions'));
if ($table !== '') {
$currentSessionId = session()->isStarted() ? session()->getId() : null;
DB::table($table)
->where('user_id', $user->id)
->when($event instanceof PasswordChanged && $currentSessionId, function ($query) use ($currentSessionId): void {
->when($event instanceof PasswordChanged && $currentSessionId, function (Builder $query) use ($currentSessionId): void {
$query->where('id', '!=', $currentSessionId);
})
->delete();
+14 -13
View File
@@ -65,6 +65,18 @@ class Mount extends Model implements Identifiable
'/home/container',
];
/**
* @return array<string, string>
*/
protected function casts(): array
{
return [
'id' => 'int',
'read_only' => 'bool',
'user_mountable' => 'bool',
];
}
/**
* Normalizes an absolute path string by resolving '.', '..', and duplicate slashes
* without requiring the path to exist on the host filesystem.
@@ -80,25 +92,14 @@ class Mount extends Model implements Identifiable
if ($segment === '..') {
array_pop($parts);
continue;
}
$parts[] = $segment;
}
return '/' . implode('/', $parts);
}
/**
* @return array<string, string>
*/
protected function casts(): array
{
return [
'id' => 'int',
'read_only' => 'bool',
'user_mountable' => 'bool',
];
return '/'.implode('/', $parts);
}
/**
+1 -2
View File
@@ -26,7 +26,7 @@ class NotInPathHierarchy implements ValidationRule
foreach ($this->invalidPaths as $blocked) {
$blocked = rtrim($blocked, '/');
if ($path === $blocked || str_starts_with($path, $blocked . '/')) {
if ($path === $blocked || str_starts_with($path, $blocked.'/')) {
$fail("The {$attribute} path cannot be or reside within [{$blocked}].");
return;
@@ -34,4 +34,3 @@ class NotInPathHierarchy implements ValidationRule
}
}
}