diff --git a/app/Http/Middleware/UsernameUUID.php b/app/Http/Middleware/UsernameUUID.php
index 2463df6..29a93cf 100644
--- a/app/Http/Middleware/UsernameUUID.php
+++ b/app/Http/Middleware/UsernameUUID.php
@@ -20,8 +20,18 @@ class UsernameUUID
$input = $request->all();
if (isset($input['uuid']))
{
- $username = $input['uuid'];
- $input['uuid'] = UUID::toUUID($username);
+ try
+ {
+ $username = $input['uuid'];
+ $input['uuid'] = UUID::toUUID($username);
+ }
+ catch(\InvalidArgumentException $iae)
+ {
+ report($iae);
+
+ $request->session()->flash('error', $iae->getMessage());
+ return redirect(route('register'));
+ }
$request->replace($input);
}
diff --git a/app/UUID/UUID.php b/app/UUID/UUID.php
index f0ca005..cee10d1 100644
--- a/app/UUID/UUID.php
+++ b/app/UUID/UUID.php
@@ -23,7 +23,13 @@ class UUID
$username
])->body(), true);
- return $response[0]['id'];
+ if (isset($response[0]))
+ {
+ 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
diff --git a/resources/views/auth/register.blade.php b/resources/views/auth/register.blade.php
index b63ddc2..6b0ed88 100644
--- a/resources/views/auth/register.blade.php
+++ b/resources/views/auth/register.blade.php
@@ -1,9 +1,22 @@
@extends('layouts.app')
@section('content')
+
+
+ {{ session('error') }} +
+