Changeset View
Changeset View
Standalone View
Standalone View
src/app/Http/Controllers/API/SignupController.php
Show First 20 Lines • Show All 365 Lines • ▼ Show 20 Lines | protected static function validateLogin($login, $domain, $external = false): ?array | ||||
if ($external) { | if ($external) { | ||||
if (Domain::where('namespace', $domain)->first()) { | if (Domain::where('namespace', $domain)->first()) { | ||||
return ['domain' => \trans('validation.domainexists')]; | return ['domain' => \trans('validation.domainexists')]; | ||||
} | } | ||||
} | } | ||||
// Check if user with specified login already exists | // Check if user with specified login already exists | ||||
$email = $login . '@' . $domain; | $email = $login . '@' . $domain; | ||||
if (User::emailExists($email)) { | if (User::emailExists($email) || User::aliasExists($email)) { | ||||
return ['login' => \trans('validation.loginexists')]; | return ['login' => \trans('validation.loginexists')]; | ||||
} | } | ||||
return null; | return null; | ||||
} | } | ||||
} | } |