2021-07-19 06:17:58 +02:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Invoice Ninja (https://invoiceninja.com).
|
|
|
|
*
|
|
|
|
* @link https://github.com/invoiceninja/invoiceninja source repository
|
|
|
|
*
|
2023-01-28 23:21:40 +01:00
|
|
|
* @copyright Copyright (c) 2023. Invoice Ninja LLC (https://invoiceninja.com)
|
2021-07-19 06:17:58 +02:00
|
|
|
*
|
|
|
|
* @license https://www.elastic.co/licensing/elastic-license
|
|
|
|
*/
|
|
|
|
|
|
|
|
namespace App\Http\Requests\Login;
|
|
|
|
|
|
|
|
use App\Http\Requests\Request;
|
2022-04-29 00:50:39 +02:00
|
|
|
use App\Http\ValidationRules\Account\BlackListRule;
|
2022-04-30 03:55:39 +02:00
|
|
|
use App\Http\ValidationRules\Account\EmailBlackListRule;
|
2022-04-29 00:50:39 +02:00
|
|
|
use App\Utils\Ninja;
|
2021-07-19 06:17:58 +02:00
|
|
|
|
|
|
|
class LoginRequest extends Request
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Determine if the user is authorized to make this request.
|
|
|
|
*
|
|
|
|
* @return bool
|
|
|
|
*/
|
|
|
|
public function authorize()
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the validation rules that apply to the request.
|
|
|
|
*
|
|
|
|
* @return array
|
|
|
|
*/
|
|
|
|
public function rules()
|
|
|
|
{
|
2022-06-21 11:57:17 +02:00
|
|
|
if (Ninja::isHosted()) {
|
2022-04-30 03:55:39 +02:00
|
|
|
$email_rules = ['required', new BlackListRule, new EmailBlackListRule];
|
2022-06-21 11:57:17 +02:00
|
|
|
} else {
|
2022-04-29 00:50:39 +02:00
|
|
|
$email_rules = 'required';
|
2022-06-21 11:57:17 +02:00
|
|
|
}
|
2022-04-29 00:50:39 +02:00
|
|
|
|
2021-07-19 06:17:58 +02:00
|
|
|
return [
|
2022-04-29 00:50:39 +02:00
|
|
|
'email' => $email_rules,
|
2022-04-20 23:25:00 +02:00
|
|
|
'password' => 'required|max:1000',
|
2021-07-19 06:17:58 +02:00
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|