You've already forked Epicnabbo-Catalogus-Updated-Daily
🆙 More fixes 🆙
This commit is contained in:
@@ -26,15 +26,15 @@ 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') {
|
||||
if ((setting('disable_registration') ?: '0') === '1') {
|
||||
throw ValidationException::withMessages([
|
||||
'registration' => __('Registration is disabled.'),
|
||||
]);
|
||||
}
|
||||
|
||||
$ip = request()?->ip();
|
||||
$ip = request()->ip();
|
||||
if (! filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 | FILTER_FLAG_IPV6)) {
|
||||
throw ValidationException::withMessages([
|
||||
'registration' => __('Your IP address seems to be invalid'),
|
||||
@@ -57,7 +57,7 @@ class CreateNewUser implements CreatesNewUsers
|
||||
$user = User::create([
|
||||
'username' => $input['username'],
|
||||
'mail' => $input['mail'],
|
||||
'password' => Hash::make($input['password']),
|
||||
'password' => Hash::make((string) $input['password']),
|
||||
'account_created' => time(),
|
||||
'last_login' => time(),
|
||||
'motto' => setting('start_motto') ?: 'Welcome to the hotel!',
|
||||
@@ -87,12 +87,12 @@ class CreateNewUser implements CreatesNewUsers
|
||||
->first();
|
||||
|
||||
if (is_null($referralUser)) {
|
||||
return redirect(RouteServiceProvider::HOME);
|
||||
return $user;
|
||||
}
|
||||
|
||||
// If same IP skip referral incrementation
|
||||
if ($referralUser->ip_current == $user->ip_current || $referralUser->ip_register == $user->ip_register) {
|
||||
return redirect(RouteServiceProvider::HOME);
|
||||
return $user;
|
||||
}
|
||||
|
||||
$referralUser->referrals()->updateOrCreate(['user_id' => $referralUser->id], [
|
||||
|
||||
Reference in New Issue
Block a user