forked from miguel456/rbrecruiter
Fix error where exception appeared instead of error message
This commit fixes an issue with fake MC usernames being used and resulting in a fatal exception. Displays an error msg now.
This commit is contained in:
parent
c58c46eda8
commit
ed95f02e00
|
@ -19,9 +19,19 @@ class UsernameUUID
|
||||||
{
|
{
|
||||||
$input = $request->all();
|
$input = $request->all();
|
||||||
if (isset($input['uuid']))
|
if (isset($input['uuid']))
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
$username = $input['uuid'];
|
$username = $input['uuid'];
|
||||||
$input['uuid'] = UUID::toUUID($username);
|
$input['uuid'] = UUID::toUUID($username);
|
||||||
|
}
|
||||||
|
catch(\InvalidArgumentException $iae)
|
||||||
|
{
|
||||||
|
report($iae);
|
||||||
|
|
||||||
|
$request->session()->flash('error', $iae->getMessage());
|
||||||
|
return redirect(route('register'));
|
||||||
|
}
|
||||||
|
|
||||||
$request->replace($input);
|
$request->replace($input);
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,13 @@ class UUID
|
||||||
$username
|
$username
|
||||||
])->body(), true);
|
])->body(), true);
|
||||||
|
|
||||||
|
if (isset($response[0]))
|
||||||
|
{
|
||||||
return $response[0]['id'];
|
return $response[0]['id'];
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new \InvalidArgumentException("You must supply a valid, premium Minecraft account to sign up.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Note: Caching could simply be assigning the username to it's UUID, however, to make this work, we'd need to loop over all cache items, which would be slighly ineffective
|
// Note: Caching could simply be assigning the username to it's UUID, however, to make this work, we'd need to loop over all cache items, which would be slighly ineffective
|
||||||
|
|
|
@ -1,9 +1,22 @@
|
||||||
@extends('layouts.app')
|
@extends('layouts.app')
|
||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
|
|
||||||
|
<x-global-errors></x-global-errors>
|
||||||
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="row justify-content-center">
|
<div class="row justify-content-center">
|
||||||
<div class="col-md-8">
|
<div class="col-md-8">
|
||||||
|
|
||||||
|
@if (session()->has('error'))
|
||||||
|
<div class="alert alert-danger">
|
||||||
|
<i class="fas fa-exclamation"></i><b> Please verify your submission</b>
|
||||||
|
<p>
|
||||||
|
{{ session('error') }}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="card-header">{{ __('Register') }}</div>
|
<div class="card-header">{{ __('Register') }}</div>
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
<!-- Scripts -->
|
<!-- Scripts -->
|
||||||
<script src="{{ asset('js/app.js') }}" defer></script>
|
<script src="{{ asset('js/app.js') }}" defer></script>
|
||||||
|
|
||||||
|
|
||||||
<!-- Fonts -->
|
<!-- Fonts -->
|
||||||
<link rel="dns-prefetch" href="//fonts.gstatic.com">
|
<link rel="dns-prefetch" href="//fonts.gstatic.com">
|
||||||
<link href="https://fonts.googleapis.com/css?family=Nunito" rel="stylesheet">
|
<link href="https://fonts.googleapis.com/css?family=Nunito" rel="stylesheet">
|
||||||
|
@ -79,5 +80,7 @@
|
||||||
@yield('content')
|
@yield('content')
|
||||||
</main>
|
</main>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
Loading…
Reference in New Issue