Update SFTP authentication endpoint to support returning user public keys

This commit is contained in:
DaneEveritt 2022-05-15 15:37:58 -04:00
parent cca0010a00
commit 12927a3202
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
2 changed files with 90 additions and 54 deletions

View file

@ -2,6 +2,7 @@
namespace Pterodactyl\Http\Requests\Api\Remote;
use Illuminate\Validation\Rule;
use Illuminate\Foundation\Http\FormRequest;
class SftpAuthenticationFormRequest extends FormRequest
@ -24,8 +25,11 @@ class SftpAuthenticationFormRequest extends FormRequest
public function rules()
{
return [
'username' => 'required|string',
'password' => 'required|string',
'type' => ['nullable', 'in:password,public_key'],
'username' => ['required', 'string'],
'password' => [
Rule::when(fn () => $this->input('type') !== 'public_key', ['required', 'string'], ['nullable']),
],
];
}