Skip to content

Commit 4460b68

Browse files
Arnaud LierDaneEveritt
authored andcommitted
Match original database password length when doing a password reset (pterodactyl#1509)
1 parent fa4858f commit 4460b68

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

app/Http/Controllers/Admin/ServersController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -599,7 +599,7 @@ public function resetDatabasePassword(Request $request, $server)
599599
['id', '=', $request->input('database')],
600600
]);
601601

602-
$this->databasePasswordService->handle($database, str_random(20));
602+
$this->databasePasswordService->handle($database, str_random(24));
603603

604604
return response('', 204);
605605
}

app/Http/Controllers/Server/DatabaseController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ public function update(Request $request): JsonResponse
142142
{
143143
$this->authorize('reset-db-password', $request->attributes->get('server'));
144144

145-
$password = str_random(20);
145+
$password = str_random(24);
146146
$this->passwordService->handle($request->attributes->get('database'), $password);
147147

148148
return response()->json(['password' => $password]);

app/Services/Databases/DatabaseManagementService.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public function create($server, array $data)
6969
$data['server_id'] = $server;
7070
$data['database'] = sprintf('s%d_%s', $server, $data['database']);
7171
$data['username'] = sprintf('u%d_%s', $server, str_random(10));
72-
$data['password'] = $this->encrypter->encrypt(str_random(16));
72+
$data['password'] = $this->encrypter->encrypt(str_random(24));
7373

7474
$this->database->beginTransaction();
7575
try {

0 commit comments

Comments
 (0)