Ensure password used when creating a database is valid; closes #1852

This commit is contained in:
Dane Everitt 2020-03-15 16:25:29 -07:00
parent 1ebe376fed
commit 05d859c985
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
4 changed files with 45 additions and 16 deletions

View file

@ -3,6 +3,7 @@
namespace Pterodactyl\Services\Databases;
use Pterodactyl\Models\Database;
use Pterodactyl\Helpers\Utilities;
use Illuminate\Database\DatabaseManager;
use Illuminate\Contracts\Encryption\Encrypter;
use Pterodactyl\Extensions\DynamicDatabaseConnection;
@ -69,7 +70,9 @@ class DatabaseManagementService
$data['server_id'] = $server;
$data['database'] = sprintf('s%d_%s', $server, $data['database']);
$data['username'] = sprintf('u%d_%s', $server, str_random(10));
$data['password'] = $this->encrypter->encrypt(str_random(24));
$data['password'] = $this->encrypter->encrypt(
Utilities::randomStringWithSpecialCharacters(24)
);
$this->database->beginTransaction();
try {