mirror of
https://github.com/pelican-dev/panel.git
synced 2025-05-19 17:34:45 +02:00
Disallow 0.0.0.0
, 127.0.0.1
and localhost
as node fqdn (#1158)
* disallow `0.0.0.0`, `127.0.01` and `localhost` as node fqdn * use rules of model
This commit is contained in:
parent
a73404c1b4
commit
c689f6860b
@ -3,6 +3,7 @@
|
||||
namespace App\Filament\Admin\Resources\NodeResource\Pages;
|
||||
|
||||
use App\Filament\Admin\Resources\NodeResource;
|
||||
use App\Models\Node;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Components\Actions\Action;
|
||||
use Filament\Forms\Components\Grid;
|
||||
@ -44,7 +45,8 @@ class CreateNode extends CreateRecord
|
||||
->required()
|
||||
->autofocus()
|
||||
->live(debounce: 1500)
|
||||
->rule('prohibited', fn ($state) => is_ip($state) && request()->isSecure())
|
||||
->rules(Node::getRulesForField('fqdn'))
|
||||
->prohibited(fn ($state) => is_ip($state) && request()->isSecure())
|
||||
->label(fn ($state) => is_ip($state) ? trans('admin/node.ip_address') : trans('admin/node.domain'))
|
||||
->placeholder(fn ($state) => is_ip($state) ? '192.168.1.1' : 'node.example.com')
|
||||
->helperText(function ($state) {
|
||||
|
@ -108,7 +108,8 @@ class EditNode extends EditRecord
|
||||
->required()
|
||||
->autofocus()
|
||||
->live(debounce: 1500)
|
||||
->rule('prohibited', fn ($state) => is_ip($state) && request()->isSecure())
|
||||
->rules(Node::getRulesForField('fqdn'))
|
||||
->prohibited(fn ($state) => is_ip($state) && request()->isSecure())
|
||||
->label(fn ($state) => is_ip($state) ? trans('admin/node.ip_address') : trans('admin/node.domain'))
|
||||
->placeholder(fn ($state) => is_ip($state) ? '192.168.1.1' : 'node.example.com')
|
||||
->helperText(function ($state) {
|
||||
|
@ -89,7 +89,7 @@ class Node extends Model implements Validatable
|
||||
'name' => ['required', 'string', 'min:1', 'max:100'],
|
||||
'description' => ['string', 'nullable'],
|
||||
'public' => ['boolean'],
|
||||
'fqdn' => ['required', 'string'],
|
||||
'fqdn' => ['required', 'string', 'notIn:0.0.0.0,127.0.0.1,localhost'],
|
||||
'scheme' => ['required', 'string', 'in:http,https'],
|
||||
'behind_proxy' => ['boolean'],
|
||||
'memory' => ['required', 'numeric', 'min:0'],
|
||||
|
Loading…
x
Reference in New Issue
Block a user