Merge pull request #347 from 1day2die/throw_pteroerror_if_account_exists
Throw error on registration if account exists on pterodactyl
This commit is contained in:
commit
cb821fc3d9
|
@ -12,6 +12,7 @@ use Illuminate\Support\Facades\App;
|
||||||
use Illuminate\Support\Facades\Hash;
|
use Illuminate\Support\Facades\Hash;
|
||||||
use Illuminate\Support\Facades\Validator;
|
use Illuminate\Support\Facades\Validator;
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
|
use Illuminate\Validation\ValidationException;
|
||||||
|
|
||||||
class RegisterController extends Controller
|
class RegisterController extends Controller
|
||||||
{
|
{
|
||||||
|
@ -108,13 +109,17 @@ class RegisterController extends Controller
|
||||||
|
|
||||||
if ($response->failed()) {
|
if ($response->failed()) {
|
||||||
$user->delete();
|
$user->delete();
|
||||||
return $user;
|
throw ValidationException::withMessages([
|
||||||
|
'ptero_registration_error' => [__('Account already exists on Pterodactyl. Please contact the Support!')],
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$user->update([
|
$user->update([
|
||||||
'pterodactyl_id' => $response->json()['attributes']['id']
|
'pterodactyl_id' => $response->json()['attributes']['id']
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return $user;
|
return $user;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,13 @@
|
||||||
<small><strong>{{ $message }}</strong></small>
|
<small><strong>{{ $message }}</strong></small>
|
||||||
</span>
|
</span>
|
||||||
@enderror
|
@enderror
|
||||||
|
@if( $errors->has('ptero_registration_error') )
|
||||||
|
@foreach( $errors->get('ptero_registration_error') as $err )
|
||||||
|
<span class="text-danger" role="alert">
|
||||||
|
<small><strong>{{ $err }}</strong></small>
|
||||||
|
</span>
|
||||||
|
@endforeach
|
||||||
|
@endif
|
||||||
|
|
||||||
@csrf
|
@csrf
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
|
|
Loading…
Reference in a new issue