General fixes
This commit is contained in:
parent
566383ccd5
commit
98045d8896
6 changed files with 27 additions and 17 deletions
|
@ -85,8 +85,8 @@ public function checkPteroClientkey(){
|
|||
"SETTINGS::SYSTEM:ENABLE_LOGIN_LOGO" => "enable-login-logo",
|
||||
"SETTINGS::SYSTEM:PTERODACTYL:ADMIN_USER_TOKEN" => "pterodactyl-admin-api-key",
|
||||
"SETTINGS::SYSTEM:ENABLE_UPGRADE" => "enable-upgrade",
|
||||
"SETTINGS::SYSTEM:DISABLE_NEW_SERVERS" => "enable-disable-servers",
|
||||
"SETTINGS::SYSTEM:DISABLE_NEW_USERS" => "enable-disable-new-users",
|
||||
"SETTINGS::SYSTEM:CREATION_OF_NEW_SERVERS" => "enable-disable-servers",
|
||||
"SETTINGS::SYSTEM:CREATION_OF_NEW_USERS" => "enable-disable-new-users",
|
||||
];
|
||||
|
||||
|
||||
|
|
|
@ -251,6 +251,13 @@ class UserController extends Controller
|
|||
'email' => ['required', 'string', 'email', 'max:64', 'unique:users'],
|
||||
'password' => ['required', 'string', 'min:8', 'max:191'],
|
||||
]);
|
||||
|
||||
// Prevent the creation of new users via API if this is enabled.
|
||||
if (!config('SETTINGS::SYSTEM:CREATION_OF_NEW_USERS', 'true')) {
|
||||
throw ValidationException::withMessages([
|
||||
'error' => "The creation of new users has been blocked by the system administrator."
|
||||
]);
|
||||
}
|
||||
|
||||
$user = User::create([
|
||||
'name' => $request->input('name'),
|
||||
|
|
|
@ -136,9 +136,12 @@ class ServerController extends Controller
|
|||
return redirect()->route('profile.index')->with('error', __("You are required to verify your email address before you can create a server."));
|
||||
}
|
||||
|
||||
//Required Verification for creating an server
|
||||
if (config('SETTINGS::SYSTEM:DISABLE_NEW_SERVERS', 'false') === 'true' && !Auth::user()->role === "admin") {
|
||||
return redirect()->route('servers.index')->with('error', __("The system administrator has prevented the creation of new servers."));
|
||||
/**
|
||||
* Required Verification for creating an server
|
||||
* Todo: Tell the administrator that server creation has been disabled?
|
||||
*/
|
||||
if (!config('SETTINGS::SYSTEM:CREATION_OF_NEW_SERVERS', 'true') && Auth::user()->role != "admin") {
|
||||
return redirect()->route('servers.index')->with('error', __("The system administrator has blocked the creation of new servers."));
|
||||
}
|
||||
|
||||
//Required Verification for creating an server
|
||||
|
|
|
@ -518,21 +518,21 @@ class SettingsSeeder extends Seeder
|
|||
Settings::firstOrCreate([
|
||||
'key' => 'SETTINGS::SYSTEM:ENABLE_UPGRADE',
|
||||
], [
|
||||
'value' =>"",
|
||||
'type' => 'string',
|
||||
'value' => "false",
|
||||
'type' => 'boolean',
|
||||
'description' => 'Enables the updgrade/downgrade feature for servers'
|
||||
]);
|
||||
Settings::firstOrCreate([
|
||||
'key' => 'SETTINGS::SYSTEM:DISABLE_NEW_SERVERS',
|
||||
'key' => 'SETTINGS::SYSTEM:CREATION_OF_NEW_SERVERS',
|
||||
], [
|
||||
'value' => "",
|
||||
'value' => "true",
|
||||
'type' => 'boolean',
|
||||
'description' => 'Enable/disable the creation of new servers'
|
||||
]);
|
||||
Settings::firstOrCreate([
|
||||
'key' => 'SETTINGS::SYSTEM:DISABLE_NEW_USERS',
|
||||
'key' => 'SETTINGS::SYSTEM:CREATION_OF_NEW_USERS',
|
||||
], [
|
||||
'value' => "",
|
||||
'value' => "true",
|
||||
'type' => 'boolean',
|
||||
'description' => 'Enable/disable the creation of new users'
|
||||
]);
|
||||
|
|
|
@ -136,9 +136,9 @@
|
|||
</div>
|
||||
<div class="custom-control mb-3 p-0">
|
||||
<input value="true" id="enable-disable-new-users" name="enable-disable-new-users"
|
||||
{{ config('SETTINGS::SYSTEM:DISABLE_NEW_USERS') == 'true' ? 'checked' : '' }}
|
||||
{{ config('SETTINGS::SYSTEM:CREATION_OF_NEW_USERS') == 'true' ? 'checked' : '' }}
|
||||
type="checkbox">
|
||||
<label for="enable-disable-new-users">{{ __('Enable/disable nem users') }} </label>
|
||||
<label for="enable-disable-new-users">{{ __('Creation of new users') }} </label>
|
||||
</div>
|
||||
|
||||
<div class="custom-control mb-3 p-0">
|
||||
|
@ -220,12 +220,12 @@
|
|||
<div class="col m-0 p-0 d-flex justify-content-between align-items-center">
|
||||
<div>
|
||||
<input value="true" id="enable-disable-servers" name="enable-disable-servers"
|
||||
{{ config('SETTINGS::SYSTEM:DISABLE_NEW_SERVERS') == 'true' ? 'checked' : '' }}
|
||||
{{ config('SETTINGS::SYSTEM:CREATION_OF_NEW_SERVERS') == 'true' ? 'checked' : '' }}
|
||||
type="checkbox">
|
||||
<label for="enable-disable-servers">{{ __('Enable/disable new servers') }} </label>
|
||||
<label for="enable-disable-servers">{{ __('Creation of new servers') }} </label>
|
||||
</div>
|
||||
<i data-toggle="popover" data-trigger="hover" data-html="true"
|
||||
data-content="{{ __('Enable/disable the creation of new servers.') }}"
|
||||
data-content="{{ __('If unchecked, it will disable the creation of new servers for regular users and system moderators, this has no effect for administrators.') }}"
|
||||
class="fas fa-info-circle"></i>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
<a href="{{route('welcome')}}" class="h1"><b class="mr-1">{{config('app.name', 'Laravel')}}</b></a>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
@if(config('SETTINGS::SYSTEM:DISABLE_NEW_USERS'))
|
||||
@if(!config('SETTINGS::SYSTEM:CREATION_OF_NEW_USERS'))
|
||||
<div class="alert alert-warning p-2 m-2">
|
||||
<h5><i class="icon fas fa-exclamation-circle"></i> {{ __('Warning!') }}</h5>
|
||||
{{ __('The system administrator has blocked the registration of new users') }}
|
||||
|
|
Loading…
Add table
Reference in a new issue