You've already forked Epicnabbo-Catalogus-Updated-Daily
🆙 Add more fixes 🆙
This commit is contained in:
+8
-4
@@ -36,7 +36,9 @@ class TwoFactorAuthenticatedSessionController extends Controller
|
||||
$user = $request->challengedUser();
|
||||
|
||||
if ($code = $request->validRecoveryCode()) {
|
||||
$user->replaceRecoveryCode($code);
|
||||
if ($user !== null) {
|
||||
$user->replaceRecoveryCode($code);
|
||||
}
|
||||
|
||||
event(new RecoveryCodeReplaced($user, $code));
|
||||
} elseif (! $request->hasValidCode()) {
|
||||
@@ -49,9 +51,11 @@ class TwoFactorAuthenticatedSessionController extends Controller
|
||||
|
||||
$request->session()->regenerate();
|
||||
|
||||
$user->update([
|
||||
'ip_current' => $request->ip(),
|
||||
]);
|
||||
if ($user !== null) {
|
||||
$user->update([
|
||||
'ip_current' => $request->ip(),
|
||||
]);
|
||||
}
|
||||
|
||||
return app(TwoFactorLoginResponse::class);
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ class CreateNewUser implements CreatesNewUsers
|
||||
/**
|
||||
* Validate and create a newly registered user.
|
||||
*/
|
||||
public function create(array $input)
|
||||
public function create(array $input): User
|
||||
{
|
||||
if ((setting('disable_registration') ?: '0') == '1') {
|
||||
throw ValidationException::withMessages([
|
||||
@@ -45,7 +45,7 @@ class CreateNewUser implements CreatesNewUsers
|
||||
->orWhere('ip_register', '=', $ip)
|
||||
->count();
|
||||
|
||||
if ($matchingIpCount >= (int) (setting('max_accounts_per_ip') ?: 99)) {
|
||||
if ($matchingIpCount >= (int) (setting('max_accounts_per_ip') ?: '99')) {
|
||||
throw ValidationException::withMessages([
|
||||
'registration' => __('You have reached the max amount of allowed account'),
|
||||
]);
|
||||
@@ -65,7 +65,7 @@ class CreateNewUser implements CreatesNewUsers
|
||||
'ip_register' => $ip,
|
||||
'ip_current' => $ip,
|
||||
'auth_ticket' => '',
|
||||
'home_room' => (int) (setting('hotel_home_room') ?: 0),
|
||||
'home_room' => (int) (setting('hotel_home_room') ?: '0'),
|
||||
]);
|
||||
|
||||
$user->update([
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
namespace App\Actions\Fortify;
|
||||
|
||||
use App\Models\User;
|
||||
|
||||
class DisableTwoFactorAuthentication extends \Laravel\Fortify\Actions\DisableTwoFactorAuthentication
|
||||
{
|
||||
public function __invoke($user): void
|
||||
|
||||
@@ -55,7 +55,7 @@ class RedirectIfTwoFactorAuthenticatable
|
||||
$user = $this->validateCredentials($request);
|
||||
|
||||
if (Fortify::confirmsTwoFactorAuthentication()) {
|
||||
if ($user && $user->two_factor_secret &&
|
||||
if ($user instanceof User && $user->two_factor_secret &&
|
||||
! is_null($user->two_factor_confirmed_at) &&
|
||||
in_array(TwoFactorAuthenticatable::class, class_uses_recursive($user))) {
|
||||
return $this->twoFactorChallengeResponse($request, $user);
|
||||
@@ -64,7 +64,7 @@ class RedirectIfTwoFactorAuthenticatable
|
||||
}
|
||||
}
|
||||
|
||||
if ($user && $user->two_factor_secret &&
|
||||
if ($user instanceof User && $user->two_factor_secret &&
|
||||
in_array(TwoFactorAuthenticatable::class, class_uses_recursive($user))) {
|
||||
return $this->twoFactorChallengeResponse($request, $user);
|
||||
}
|
||||
@@ -91,7 +91,7 @@ class RedirectIfTwoFactorAuthenticatable
|
||||
|
||||
$model = $this->guard->getProvider()->getModel();
|
||||
|
||||
return tap($model::where(Fortify::username(), $request->{Fortify::username()})->first(), function ($user) use ($request) {
|
||||
return tap($model::where(Fortify::username(), $request->{Fortify::username()})->first(), function ($user) use ($request): void {
|
||||
// Update the users password to bcrypt, if they previously used md5
|
||||
if ($user && config('habbo.site.convert_passwords')) {
|
||||
$this->convertUserPassword($user, $request->input('password'));
|
||||
@@ -151,7 +151,7 @@ class RedirectIfTwoFactorAuthenticatable
|
||||
protected function twoFactorChallengeResponse(Request $request, $user): Response
|
||||
{
|
||||
$request->session()->put([
|
||||
'login.id' => $user->getKey(),
|
||||
'login.id' => $user instanceof User ? $user->getKey() : null,
|
||||
'login.remember' => $request->filled('remember'),
|
||||
]);
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace App\Actions\Fortify;
|
||||
|
||||
use App\Actions\Fortify\Rules\PasswordValidationRules;
|
||||
use App\Models\User;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Laravel\Fortify\Contracts\ResetsUserPasswords;
|
||||
@@ -11,12 +12,7 @@ class ResetUserPassword implements ResetsUserPasswords
|
||||
{
|
||||
use PasswordValidationRules;
|
||||
|
||||
/**
|
||||
* Validate and reset the user's forgotten password.
|
||||
*
|
||||
* @param mixed $user
|
||||
*/
|
||||
public function reset($user, array $input): void
|
||||
public function reset(User $user, array $input): void
|
||||
{
|
||||
Validator::make($input, [
|
||||
'password' => $this->passwordRules(),
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace App\Actions\Fortify;
|
||||
|
||||
use App\Actions\Fortify\Rules\PasswordValidationRules;
|
||||
use App\Models\User;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Laravel\Fortify\Contracts\UpdatesUserPasswords;
|
||||
@@ -11,12 +12,7 @@ class UpdateUserPassword implements UpdatesUserPasswords
|
||||
{
|
||||
use PasswordValidationRules;
|
||||
|
||||
/**
|
||||
* Validate and update the user's password.
|
||||
*
|
||||
* @param mixed $user
|
||||
*/
|
||||
public function update($user, array $input): void
|
||||
public function update(User $user, array $input): void
|
||||
{
|
||||
Validator::make($input, [
|
||||
'current_password' => ['required', 'string', 'current_password:web'],
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Actions\Fortify;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Contracts\Auth\MustVerifyEmail;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Validation\Rule;
|
||||
@@ -9,12 +10,7 @@ use Laravel\Fortify\Contracts\UpdatesUserProfileInformation;
|
||||
|
||||
class UpdateUserProfileInformation implements UpdatesUserProfileInformation
|
||||
{
|
||||
/**
|
||||
* Validate and update the given user's profile information.
|
||||
*
|
||||
* @param mixed $user
|
||||
*/
|
||||
public function update($user, array $input): void
|
||||
public function update(User $user, array $input): void
|
||||
{
|
||||
Validator::make($input, [
|
||||
'name' => ['required', 'string', 'max:255'],
|
||||
@@ -39,12 +35,7 @@ class UpdateUserProfileInformation implements UpdatesUserProfileInformation
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the given verified user's profile information.
|
||||
*
|
||||
* @param mixed $user
|
||||
*/
|
||||
protected function updateVerifiedUser($user, array $input): void
|
||||
protected function updateVerifiedUser(User $user, array $input): void
|
||||
{
|
||||
$user->forceFill([
|
||||
'name' => $input['name'],
|
||||
|
||||
@@ -3,13 +3,14 @@
|
||||
namespace App\Actions;
|
||||
|
||||
use App\Enums\CurrencyTypes;
|
||||
use App\Models\User;
|
||||
use App\Services\RconService;
|
||||
|
||||
class SendCurrency
|
||||
{
|
||||
public function __construct(protected RconService $rcon) {}
|
||||
|
||||
public function execute($user, string $type, ?int $amount)
|
||||
public function execute(User $user, string $type, ?int $amount): bool
|
||||
{
|
||||
if (! $amount || $amount <= 0) {
|
||||
return false;
|
||||
@@ -32,5 +33,7 @@ class SendCurrency
|
||||
default => false,
|
||||
};
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,30 +2,32 @@
|
||||
|
||||
namespace App\Actions;
|
||||
|
||||
use App\Models\User;
|
||||
|
||||
class UserActions
|
||||
{
|
||||
public function updateUsername($user, $username): void
|
||||
public function updateUsername(User $user, string $username): void
|
||||
{
|
||||
$user->update([
|
||||
'username' => $username,
|
||||
]);
|
||||
}
|
||||
|
||||
public function updateEmail($user, $email): void
|
||||
public function updateEmail(User $user, string $email): void
|
||||
{
|
||||
$user->update([
|
||||
'mail' => $email,
|
||||
]);
|
||||
}
|
||||
|
||||
public function updateMotto($user, $motto): void
|
||||
public function updateMotto(User $user, string $motto): void
|
||||
{
|
||||
$user->update([
|
||||
'motto' => $motto,
|
||||
]);
|
||||
}
|
||||
|
||||
public function updateField($user, string $field, ?string $value): void
|
||||
public function updateField(User $user, string $field, ?string $value): void
|
||||
{
|
||||
$user->update([
|
||||
$field => $value,
|
||||
|
||||
@@ -11,7 +11,7 @@ class BuildTheme extends Command
|
||||
|
||||
protected $description = 'Build a selected theme assets';
|
||||
|
||||
public function handle()
|
||||
public function handle(): int
|
||||
{
|
||||
$themes = $this->getAvailableThemes();
|
||||
|
||||
@@ -29,7 +29,11 @@ class BuildTheme extends Command
|
||||
|
||||
$this->info("Building {$selectedTheme} theme...");
|
||||
|
||||
$this->runBuildCommand($selectedTheme);
|
||||
if (is_array($selectedTheme)) {
|
||||
$selectedTheme = $selectedTheme[0] ?? '';
|
||||
}
|
||||
|
||||
$this->runBuildCommand((string) $selectedTheme);
|
||||
|
||||
return Command::SUCCESS;
|
||||
}
|
||||
|
||||
@@ -19,11 +19,11 @@ class DateRangeFilter extends Filter
|
||||
return $query
|
||||
->when(
|
||||
$data["{$name}_from"],
|
||||
fn (Builder $query, $date) => $query->whereDate($name, '>=', $date),
|
||||
fn (Builder $query, ?string $date) => $query->whereDate($name !== null ? $name : '', '>=', $date),
|
||||
)
|
||||
->when(
|
||||
$data["{$name}_until"],
|
||||
fn (Builder $query, $date) => $query->whereDate($name, '<=', $date),
|
||||
fn (Builder $query, ?string $date) => $query->whereDate($name !== null ? $name : '', '<=', $date),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -34,9 +34,9 @@ class BadgePage extends Page
|
||||
|
||||
protected static string $translateIdentifier = 'badge-resource';
|
||||
|
||||
public $badgeWasPreviouslyCreated;
|
||||
public bool $badgeWasPreviouslyCreated = false;
|
||||
|
||||
public ?array $data = [];
|
||||
public array $data = [];
|
||||
|
||||
public static string $roleName = 'badge_page';
|
||||
|
||||
@@ -47,9 +47,11 @@ class BadgePage extends Page
|
||||
|
||||
public function getTitle(): string|Htmlable
|
||||
{
|
||||
return __(
|
||||
$translated = __(
|
||||
sprintf('filament::resources.resources.%s.navigation_label', static::$translateIdentifier),
|
||||
);
|
||||
|
||||
return is_array($translated) ? (string) ($translated[0] ?? '') : (string) $translated;
|
||||
}
|
||||
|
||||
public function form(Schema $schema): Schema
|
||||
@@ -62,7 +64,7 @@ class BadgePage extends Page
|
||||
->label(__('filament::resources.inputs.badge_code'))
|
||||
->helperText(__('filament::resources.helpers.badge_code_helper'))
|
||||
->afterStateUpdated(function (?string $state, Set $set) {
|
||||
$set('code', strtoupper($state));
|
||||
$set('code', strtoupper((string) $state));
|
||||
})
|
||||
->suffixAction(fn (): PageAction => PageAction::make('search')->icon('heroicon-o-magnifying-glass')->action(fn () => $this->searchBadgesByCode()),
|
||||
),
|
||||
@@ -131,7 +133,7 @@ class BadgePage extends Page
|
||||
}
|
||||
|
||||
$badgeData = app(ExternalTextsParser::class)->getBadgeData($badgeCode);
|
||||
$this->badgeWasPreviouslyCreated = is_array($badgeData['nitro']) || is_array($badgeData['flash']);
|
||||
$this->badgeWasPreviouslyCreated = is_array($badgeData['nitro'] ?? null) || is_array($badgeData['flash'] ?? null);
|
||||
|
||||
if ($this->badgeWasPreviouslyCreated) {
|
||||
Notification::make()
|
||||
|
||||
@@ -14,7 +14,7 @@ use Illuminate\Validation\ValidationException;
|
||||
|
||||
class Login extends \Filament\Auth\Pages\Login
|
||||
{
|
||||
public $username = '';
|
||||
public string $username = '';
|
||||
|
||||
public function authenticate(): ?LoginResponse
|
||||
{
|
||||
@@ -26,7 +26,7 @@ class Login extends \Filament\Auth\Pages\Login
|
||||
'seconds' => $exception->secondsUntilAvailable,
|
||||
'minutes' => ceil($exception->secondsUntilAvailable / 60),
|
||||
]))
|
||||
->body(array_key_exists('body', __('filament-panels::pages/auth/login.notifications.throttled') ?: []) ? __('filament-panels::pages/auth/login.notifications.throttled.body', [
|
||||
->body(array_key_exists('body', (array) __('filament-panels::pages/auth/login.notifications.throttled') ?: []) ? __('filament-panels::pages/auth/login.notifications.throttled.body', [
|
||||
'seconds' => $exception->secondsUntilAvailable,
|
||||
'minutes' => ceil($exception->secondsUntilAvailable / 60),
|
||||
]) : null)
|
||||
|
||||
@@ -81,7 +81,7 @@ class CmsSettingResource extends Resource
|
||||
->tooltip(function (TextColumn $column): ?string {
|
||||
$state = $column->getState();
|
||||
|
||||
if (strlen($state) <= $column->getCharacterLimit()) {
|
||||
if (! is_string($state) || strlen($state) <= $column->getCharacterLimit()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -80,7 +80,7 @@ class HousekeepingPermissionResource extends Resource
|
||||
->tooltip(function (TextColumn $column): ?string {
|
||||
$state = $column->getState();
|
||||
|
||||
if (strlen($state) <= $column->getCharacterLimit()) {
|
||||
if (! is_string($state) || strlen($state) <= $column->getCharacterLimit()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -12,32 +12,40 @@ trait TranslatableResource
|
||||
return null;
|
||||
}
|
||||
|
||||
return __(
|
||||
$translated = __(
|
||||
sprintf('filament::resources.navigations.%s', static::$navigationGroup),
|
||||
);
|
||||
|
||||
return is_array($translated) ? (string) ($translated[0] ?? '') : (string) $translated;
|
||||
}
|
||||
|
||||
public static function getPluralModelLabel(): string
|
||||
{
|
||||
return __(sprintf(
|
||||
$translated = __(sprintf(
|
||||
Str::endsWith(static::class, 'RelationManager')
|
||||
? 'filament::resources.resources.%s.navigation_label'
|
||||
: 'filament::resources.resources.%s.plural',
|
||||
static::$translateIdentifier,
|
||||
));
|
||||
|
||||
return is_array($translated) ? (string) ($translated[0] ?? '') : (string) $translated;
|
||||
}
|
||||
|
||||
public static function getNavigationLabel(): string
|
||||
{
|
||||
return __(
|
||||
$translated = __(
|
||||
sprintf('filament::resources.resources.%s.navigation_label', static::$translateIdentifier),
|
||||
);
|
||||
|
||||
return is_array($translated) ? (string) ($translated[0] ?? '') : (string) $translated;
|
||||
}
|
||||
|
||||
public static function getModelLabel(): string
|
||||
{
|
||||
return __(
|
||||
$translated = __(
|
||||
sprintf('filament::resources.resources.%s.label', static::$translateIdentifier),
|
||||
);
|
||||
|
||||
return is_array($translated) ? (string) ($translated[0] ?? '') : (string) $translated;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user