Discord 0Auth more optional, .env.example cleanup

This commit is contained in:
AVMG20 2021-06-12 14:50:51 +02:00
parent 3cb0c042fc
commit 6969b7fadf
3 changed files with 12 additions and 14 deletions

View file

@ -11,6 +11,9 @@ DB_DATABASE=controlpanel
DB_USERNAME=root
DB_PASSWORD=root
#without a pterodactyl api token, this panel won't work!
PTERODACTYL_TOKEN=
#paypal details, you only need sandbox for testing! you can do this by setting the APP_ENV to local
PAYPAL_SANDBOX_SECRET=
PAYPAL_SANDBOX_CLIENT_ID=
@ -18,7 +21,6 @@ PAYPAL_SECRET=
PAYPAL_CLIENT_ID=
PAYPAL_EMAIL=
DISCORD_INVITE_URL=https://discord.gg/vrUYdxG4wZ
#set-up for extra discord verification
DISCORD_CLIENT_ID=
DISCORD_CLIENT_SECRET=
@ -26,9 +28,10 @@ DISCORD_CLIENT_SECRET=
DISCORD_BOT_TOKEN=YOUR_DISCORD_BOT_TOKEN
DISCORD_GUILD_ID=YOUR_DISCORD_SERVER_ID
PTERODACTYL_TOKEN=
#nesseary URL's
PTERODACTYL_URL=https://panel.bitsec.dev
PHPMYADMIN_URL=https://mysql.bitsec.dev
DISCORD_INVITE_URL=https://discord.gg/vrUYdxG4wZ
#GOOGLE RECAPTCHA
RECAPTCHA_SITE_KEY=YOUR_API_SITE_KEY

View file

@ -13,8 +13,10 @@ class SocialiteController extends Controller
{
public function redirect()
{
$scopes = !empty(env('DISCORD_BOT_TOKEN')) && !empty(env('DISCORD_GUILD_ID')) ? ['guilds.join'] : [];
return Socialite::driver('discord')
->scopes(['guilds.join'])
->scopes($scopes)
->redirect();
}
@ -27,8 +29,8 @@ class SocialiteController extends Controller
$discord = Socialite::driver('discord')->user();
$discordUser = DiscordUser::find($discord->id);
$guildId = env('DISCORD_GUILD_ID', null);
$botToken = env('DISCORD_BOT_TOKEN', null);
$guildId = env('DISCORD_GUILD_ID');
$botToken = env('DISCORD_BOT_TOKEN');
//force user into discord server
//TODO Add event on failure, to notify ppl involved
@ -47,8 +49,8 @@ class SocialiteController extends Controller
//create discord user in db
DiscordUser::create(array_merge($discord->user, ['user_id' => Auth::user()->id]));
//update user
Auth::user()->increment('credits' , Configuration::getValueByKey('CREDITS_REWARD_AFTER_VERIFY_DISCORD'));
Auth::user()->increment('server_limit' , Configuration::getValueByKey('SERVER_LIMIT_REWARD_AFTER_VERIFY_DISCORD'));
Auth::user()->increment('credits', Configuration::getValueByKey('CREDITS_REWARD_AFTER_VERIFY_DISCORD'));
Auth::user()->increment('server_limit', Configuration::getValueByKey('SERVER_LIMIT_REWARD_AFTER_VERIFY_DISCORD'));
Auth::user()->update(['discord_verified_at' => now()]);
} else {
$discordUser->update($discord->user);

View file

@ -59,13 +59,6 @@ class ConfigurationSeeder extends Seeder
'type' => 'integer',
]);
Configuration::firstOrCreate([
'key' => 'DISCORD_VERIFY_COMMAND',
], [
'value' => '!verify',
'type' => 'string',
]);
//other
Configuration::firstOrCreate([
'key' => 'MINIMUM_REQUIRED_CREDITS_TO_MAKE_SERVER',