mirror of
https://github.com/Bubka/2FAuth.git
synced 2025-07-18 13:14:20 +02:00
46 lines
1.0 KiB
PHP
46 lines
1.0 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Requests;
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
use Illuminate\Support\Facades\Auth;
|
|
use Illuminate\Support\Facades\Gate;
|
|
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
|
|
|
|
class WebauthnRenameRequest extends FormRequest
|
|
{
|
|
/**
|
|
* Handle a failed authorization attempt.
|
|
*
|
|
* @return void
|
|
*
|
|
* @throws \Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException
|
|
*/
|
|
protected function failedAuthorization()
|
|
{
|
|
throw new AccessDeniedHttpException(__('errors.unsupported_with_sso_only'));
|
|
}
|
|
|
|
/**
|
|
* Determine if the user is authorized to make this request.
|
|
*
|
|
* @return bool
|
|
*/
|
|
public function authorize()
|
|
{
|
|
return Auth::check() && Gate::allows('manage-webauthn-credentials');
|
|
}
|
|
|
|
/**
|
|
* Get the validation rules that apply to the request.
|
|
*
|
|
* @return array
|
|
*/
|
|
public function rules()
|
|
{
|
|
return [
|
|
'name' => 'required|string',
|
|
];
|
|
}
|
|
}
|