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,
|
||||
|
||||
Reference in New Issue
Block a user