Added giant warning message if you attempt to change an encryption key once one has been set.

This commit is contained in:
Dane Everitt 2018-03-10 15:18:24 -06:00
parent 80994dc12e
commit 21cd0688e0
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
3 changed files with 34 additions and 0 deletions

View file

@ -15,6 +15,7 @@ This project follows [Semantic Versioning](http://semver.org) guidelines.
### Added
* Added ability for end users to change the name of their server through the UI. This option is only open to the server owner or an admin.
* Added giant warning message if you attempt to change an encryption key once one has been set.
### Changed
* Panel now throws proper 504: Gateway Timeout errors on server listing when daemon is offline.

View file

@ -0,0 +1,28 @@
<?php
namespace Pterodactyl\Console\Commands\Overrides;
use Illuminate\Foundation\Console\KeyGenerateCommand as BaseKeyGenerateCommand;
class KeyGenerateCommand extends BaseKeyGenerateCommand
{
/**
* Override the default Laravel key generation command to throw a warning to the user
* if it appears that they have already generated an application encryption key.
*/
public function handle()
{
if (! empty(config('app.key')) && $this->input->isInteractive()) {
$this->output->warning(trans('command/messages.key.warning'));
if (! $this->confirm(trans('command/messages.key.confirm'))) {
return;
}
if (! $this->confirm(trans('command/messages.key.final_confirm'))) {
return;
}
}
parent::handle();
}
}

View file

@ -1,6 +1,11 @@
<?php
return [
'key' => [
'warning' => 'It appears you have already configured an application encryption key. Continuing with this process with overwrite that key and cause data corruption for any existing encrypted data. DO NOT CONTINUE UNLESS YOU KNOW WHAT YOU ARE DOING.',
'confirm' => 'I understand the consequences of performing this command and accept all responsibility for the loss of encrypted data.',
'final_confirm' => 'Are you sure you wish to continue? Changing the application encryption key WILL CAUSE DATA LOSS.',
],
'location' => [
'no_location_found' => 'Could not locate a record matching the provided short code.',
'ask_short' => 'Location Short Code',