1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-09-22 01:11:34 +02:00
invoiceninja/app/Http/Requests/Login/LoginRequest.php

50 lines
1.1 KiB
PHP
Raw Normal View History

<?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)
*
* @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;
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()
{
if (Ninja::isHosted()) {
2022-04-30 03:55:39 +02:00
$email_rules = ['required', new BlackListRule, new EmailBlackListRule];
} else {
2022-04-29 00:50:39 +02:00
$email_rules = 'required';
}
2022-04-29 00:50:39 +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',
];
}
}