37 lines
940 B
PHP
37 lines
940 B
PHP
<?php
|
|
|
|
namespace App\Http\Requests;
|
|
|
|
use App\Facades\Options;
|
|
use Illuminate\Auth\Access\AuthorizationException;
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
class ValidateInviteRequest extends FormRequest
|
|
{
|
|
/**
|
|
* Determine if the user is authorized to make this request.
|
|
*/
|
|
public function authorize(): bool
|
|
{
|
|
return !Options::getOption('enable_registrations');
|
|
}
|
|
|
|
/**
|
|
* Get the validation rules that apply to the request.
|
|
*
|
|
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
|
|
*/
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
'validation_token' => 'required|string',
|
|
'email' => 'required|email'
|
|
];
|
|
}
|
|
|
|
protected function failedAuthorization()
|
|
{
|
|
throw new AuthorizationException(__('Sign ups are open! There\'s nothing to validate. Feel free to sign up at any time.'));
|
|
}
|
|
}
|