Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
pterodactyl
GitHub Repository: pterodactyl/panel
Path: blob/1.0-develop/app/Http/Requests/Api/Remote/SftpAuthenticationFormRequest.php
10266 views
1
<?php
2
3
namespace Pterodactyl\Http\Requests\Api\Remote;
4
5
use Illuminate\Foundation\Http\FormRequest;
6
7
class SftpAuthenticationFormRequest extends FormRequest
8
{
9
/**
10
* Authenticate the request.
11
*/
12
public function authorize(): bool
13
{
14
return true;
15
}
16
17
/**
18
* Rules to apply to the request.
19
*/
20
public function rules(): array
21
{
22
return [
23
'type' => ['nullable', 'in:password,public_key'],
24
'username' => ['required', 'string'],
25
'password' => ['required', 'string'],
26
];
27
}
28
29
/**
30
* Return only the fields that we are interested in from the request.
31
* This will include empty fields as a null value.
32
*/
33
public function normalize(): array
34
{
35
return $this->only(
36
array_keys($this->rules())
37
);
38
}
39
}
40
41