Forced Discord Account and Mail Verification
#72 This is configurable using: VERIFIED_DISCORD_TO_MAKE_SERVER and VERIFIED_EMAIL_TO_MAKE_SERVER')
This commit is contained in:
parent
137f54818d
commit
b6a654082a
2 changed files with 33 additions and 15 deletions
|
@ -11,12 +11,7 @@ use App\Models\Node;
|
||||||
use App\Models\Product;
|
use App\Models\Product;
|
||||||
use App\Models\Server;
|
use App\Models\Server;
|
||||||
use App\Notifications\ServerCreationError;
|
use App\Notifications\ServerCreationError;
|
||||||
use Exception;
|
|
||||||
use Illuminate\Contracts\View\Factory;
|
|
||||||
use Illuminate\Contracts\View\View;
|
|
||||||
use Illuminate\Http\RedirectResponse;
|
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Http\Response;
|
|
||||||
use Illuminate\Support\Facades\Auth;
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
|
||||||
|
|
||||||
|
@ -38,6 +33,16 @@ class ServerController extends Controller
|
||||||
return redirect()->route('servers.index')->with('error', "You've already reached your server limit!");
|
return redirect()->route('servers.index')->with('error', "You've already reached your server limit!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Required Verification for creating an server
|
||||||
|
if(Configuration::getValueByKey('VERIFIED_EMAIL_TO_MAKE_SERVER') === 'true' && !Auth::user()->hasVerifiedEmail()) {
|
||||||
|
return redirect()->route('profile.index')->with('error', "You havent verified your email! Thats required to create an server.");
|
||||||
|
}
|
||||||
|
|
||||||
|
//Required Verification for creating an server
|
||||||
|
if(Configuration::getValueByKey('VERIFIED_DISCORD_TO_MAKE_SERVER') === 'true' && !Auth::user()->discordUser) {
|
||||||
|
return redirect()->route('profile.index')->with('error', "You havent linked an Discord Account to your profile! Thats required to create an server");
|
||||||
|
}
|
||||||
|
|
||||||
//minimum credits
|
//minimum credits
|
||||||
if (Auth::user()->credits <= Configuration::getValueByKey('MINIMUM_REQUIRED_CREDITS_TO_MAKE_SERVER' , 50)) {
|
if (Auth::user()->credits <= Configuration::getValueByKey('MINIMUM_REQUIRED_CREDITS_TO_MAKE_SERVER' , 50)) {
|
||||||
return redirect()->route('servers.index')->with('error', "You do not have the required amount of credits to create a new server!");
|
return redirect()->route('servers.index')->with('error', "You do not have the required amount of credits to create a new server!");
|
||||||
|
@ -68,7 +73,6 @@ class ServerController extends Controller
|
||||||
if (Auth::user()->servers()->count() >= Auth::user()->server_limit) {
|
if (Auth::user()->servers()->count() >= Auth::user()->server_limit) {
|
||||||
return redirect()->route('servers.index')->with('error', 'Server limit reached!');
|
return redirect()->route('servers.index')->with('error', 'Server limit reached!');
|
||||||
}
|
}
|
||||||
|
|
||||||
//minimum credits
|
//minimum credits
|
||||||
if (Auth::user()->credits <= Configuration::getValueByKey('MINIMUM_REQUIRED_CREDITS_TO_MAKE_SERVER' , 50)) {
|
if (Auth::user()->credits <= Configuration::getValueByKey('MINIMUM_REQUIRED_CREDITS_TO_MAKE_SERVER' , 50)) {
|
||||||
return redirect()->route('servers.index')->with('error', "You do not have the required amount of credits to create a new server!");
|
return redirect()->route('servers.index')->with('error', "You do not have the required amount of credits to create a new server!");
|
||||||
|
|
|
@ -37,6 +37,20 @@ class ConfigurationSeeder extends Seeder
|
||||||
'type' => 'integer',
|
'type' => 'integer',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
Configuration::firstOrCreate([
|
||||||
|
'key' => 'VERIFIED_EMAIL_TO_MAKE_SERVER',
|
||||||
|
], [
|
||||||
|
'value' => 'true',
|
||||||
|
'type' => 'boolean',
|
||||||
|
]);
|
||||||
|
|
||||||
|
Configuration::firstOrCreate([
|
||||||
|
'key' => 'VERIFIED_DISCORD_TO_MAKE_SERVER',
|
||||||
|
], [
|
||||||
|
'value' => 'true',
|
||||||
|
'type' => 'boolean',
|
||||||
|
]);
|
||||||
|
|
||||||
Configuration::firstOrCreate([
|
Configuration::firstOrCreate([
|
||||||
'key' => 'SERVER_LIMIT_REWARD_AFTER_VERIFY_EMAIL',
|
'key' => 'SERVER_LIMIT_REWARD_AFTER_VERIFY_EMAIL',
|
||||||
], [
|
], [
|
||||||
|
|
Loading…
Add table
Reference in a new issue