fix: prevent account creation through Discord when registrations are disabled
Signed-off-by: Miguel Nogueira <me@nogueira.codes>
This commit is contained in:
@@ -21,6 +21,7 @@
|
|||||||
|
|
||||||
namespace App\Http\Controllers\Auth;
|
namespace App\Http\Controllers\Auth;
|
||||||
|
|
||||||
|
use App\Facades\Options;
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use App\User;
|
use App\User;
|
||||||
use GuzzleHttp\Exception\ClientException;
|
use GuzzleHttp\Exception\ClientException;
|
||||||
@@ -70,6 +71,14 @@ class DiscordController extends Controller
|
|||||||
|
|
||||||
Auth::login($appUser, true);
|
Auth::login($appUser, true);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
if (!Options::getOption('enable_registrations'))
|
||||||
|
{
|
||||||
|
return redirect()
|
||||||
|
->route('home')
|
||||||
|
->with('error', __('Hey there, ' . $discordUser->getName() . '! Sign ups are currently closed so we were not able to create your account. Head over to the sign up page to request an invitation if you\'d like. Alternatively, if you already have an account here, make sure to log in with Discord with the correct account you linked beforehand.'));
|
||||||
|
}
|
||||||
|
|
||||||
$oAuthUser = User::create([
|
$oAuthUser = User::create([
|
||||||
'uuid' => null,
|
'uuid' => null,
|
||||||
'name' => $discordUser->getName(),
|
'name' => $discordUser->getName(),
|
||||||
|
Reference in New Issue
Block a user