2021-09-17 23:48:30 +02:00
|
|
|
<?php
|
|
|
|
|
2021-11-07 21:57:22 +01:00
|
|
|
namespace App\Api\v1\Requests;
|
2021-09-17 23:48:30 +02:00
|
|
|
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
2021-11-13 13:36:34 +01:00
|
|
|
use Illuminate\Support\Facades\Auth;
|
2021-09-17 23:48:30 +02:00
|
|
|
|
|
|
|
class TwoFAccountUriRequest extends FormRequest
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Determine if the user is authorized to make this request.
|
|
|
|
*
|
|
|
|
* @return bool
|
|
|
|
*/
|
|
|
|
public function authorize()
|
|
|
|
{
|
2021-11-13 13:36:34 +01:00
|
|
|
return Auth::check();
|
2021-09-17 23:48:30 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the validation rules that apply to the request.
|
|
|
|
*
|
|
|
|
* @return array
|
|
|
|
*/
|
|
|
|
public function rules()
|
|
|
|
{
|
|
|
|
return [
|
2022-07-05 10:10:24 +02:00
|
|
|
'uri' => 'required|string|regex:/^otpauth:\/\/[h,t]otp\//i',
|
|
|
|
'custom_otp' => 'string|in:steamtotp',
|
2021-09-17 23:48:30 +02:00
|
|
|
];
|
|
|
|
}
|
2022-10-10 12:55:59 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Prepare the data for validation.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
protected function prepareForValidation()
|
|
|
|
{
|
|
|
|
$this->merge([
|
|
|
|
'custom_otp' => strtolower($this->custom_otp),
|
|
|
|
]);
|
|
|
|
}
|
2022-11-22 15:15:52 +01:00
|
|
|
}
|