2018-04-07 12:35:15 -05:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Pterodactyl\Http\Requests\Auth;
|
|
|
|
|
2020-07-02 23:01:02 -07:00
|
|
|
use Illuminate\Validation\Rule;
|
2018-04-07 12:35:15 -05:00
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
|
|
|
|
class LoginCheckpointRequest extends FormRequest
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Determine if the request is authorized.
|
|
|
|
*
|
|
|
|
* @return bool
|
|
|
|
*/
|
|
|
|
public function authorize(): bool
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Rules to apply to the request.
|
|
|
|
*
|
|
|
|
* @return array
|
|
|
|
*/
|
|
|
|
public function rules(): array
|
|
|
|
{
|
|
|
|
return [
|
|
|
|
'confirmation_token' => 'required|string',
|
2020-07-02 23:01:02 -07:00
|
|
|
'authentication_code' => [
|
|
|
|
'nullable',
|
|
|
|
'numeric',
|
|
|
|
Rule::requiredIf(function () {
|
|
|
|
return empty($this->input('recovery_token'));
|
|
|
|
}),
|
|
|
|
],
|
|
|
|
'recovery_token' => [
|
|
|
|
'nullable',
|
|
|
|
'string',
|
|
|
|
Rule::requiredIf(function () {
|
|
|
|
return empty($this->input('authentication_code'));
|
|
|
|
}),
|
|
|
|
],
|
2018-04-07 12:35:15 -05:00
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|