mirror of
https://github.com/vitodeploy/vito.git
synced 2025-04-19 01:41:36 +00:00
Fix isolated user validation (#450)
This commit is contained in:
parent
d702b95e0c
commit
1e4a944acb
@ -114,7 +114,7 @@ public static function rules(Server $server, array $input): array
|
||||
'regex:/^[a-z_][a-z0-9_-]*[a-z0-9]$/',
|
||||
'min:3',
|
||||
'max:32',
|
||||
'unique:sites,user',
|
||||
Rule::unique('sites', 'user')->where('server_id', $server->id),
|
||||
Rule::notIn($server->getSshUsers()),
|
||||
],
|
||||
];
|
||||
|
@ -52,6 +52,7 @@ public function index(Project $project, Server $server): ResourceCollection
|
||||
#[BodyParam(name: 'branch', description: 'Branch, Required for Sites which support source control', example: 'main')]
|
||||
#[BodyParam(name: 'composer', type: 'boolean', description: 'Run composer if site supports composer', example: true)]
|
||||
#[BodyParam(name: 'version', description: 'Version, if the site type requires a version like PHPMyAdmin', example: '5.2.1')]
|
||||
#[BodyParam(name: 'user', description: 'user, to isolate the website under a new user')]
|
||||
#[ResponseFromApiResource(SiteResource::class, Site::class)]
|
||||
public function create(Request $request, Project $project, Server $server): SiteResource
|
||||
{
|
||||
|
@ -134,9 +134,9 @@ protected function getHeaderActions(): array
|
||||
// WordPress
|
||||
$this->wordpressFields(),
|
||||
TextInput::make('user')
|
||||
->label('Username')
|
||||
->hintIcon('heroicon-o-information-circle')
|
||||
->hintIconTooltip(
|
||||
->label('User')
|
||||
->placeholder('vito')
|
||||
->helperText(
|
||||
'Optional. If provided, a new user will be created and the site will be owned by this user.'
|
||||
)
|
||||
->rules(fn (Get $get) => CreateSite::rules($this->server, $get())['user']),
|
||||
|
Loading…
x
Reference in New Issue
Block a user