mirror of
https://github.com/tiennm99/coolify.git
synced 2026-09-03 18:16:43 +00:00
fix(server): share SSH username validation
Centralize SSH username rules and sanitization so dotted usernames are accepted consistently across API, onboarding, and Livewire server forms.
This commit is contained in:
@@ -8,6 +8,7 @@ use App\Models\Project;
|
||||
use App\Models\Server;
|
||||
use App\Models\Team;
|
||||
use App\Services\ConfigurationRepository;
|
||||
use App\Support\ValidationPatterns;
|
||||
use Illuminate\Support\Collection;
|
||||
use Livewire\Attributes\Url;
|
||||
use Livewire\Component;
|
||||
@@ -278,7 +279,7 @@ class Index extends Component
|
||||
'remoteServerName' => 'required|string',
|
||||
'remoteServerHost' => 'required|string',
|
||||
'remoteServerPort' => 'required|integer',
|
||||
'remoteServerUser' => 'required|string|regex:/^[a-zA-Z0-9._-]+$/',
|
||||
'remoteServerUser' => ValidationPatterns::serverUsernameRules(),
|
||||
]);
|
||||
|
||||
$this->privateKey = formatPrivateKey($this->privateKey);
|
||||
@@ -467,7 +468,7 @@ class Index extends Component
|
||||
{
|
||||
$this->validate([
|
||||
'remoteServerPort' => 'required|integer|min:1|max:65535',
|
||||
'remoteServerUser' => 'required|string|regex:/^[a-zA-Z0-9._-]+$/',
|
||||
'remoteServerUser' => ValidationPatterns::serverUsernameRules(),
|
||||
]);
|
||||
|
||||
$this->createdServer->update([
|
||||
|
||||
Reference in New Issue
Block a user