Changeset View
Changeset View
Standalone View
Standalone View
src/app/Http/Controllers/API/SignupController.php
<?php | <?php | ||||
namespace App\Http\Controllers\API; | namespace App\Http\Controllers\API; | ||||
use App\Http\Controllers\Controller; | use App\Http\Controllers\Controller; | ||||
use App\Jobs\SignupVerificationEmail; | use App\Jobs\SignupVerificationEmail; | ||||
use App\Jobs\SignupVerificationSMS; | use App\Jobs\SignupVerificationSMS; | ||||
use App\Discount; | use App\Discount; | ||||
use App\Domain; | use App\Domain; | ||||
use App\Plan; | use App\Plan; | ||||
use App\Rules\ExternalEmail; | use App\Rules\SignupExternalEmail; | ||||
use App\Rules\UserEmailDomain; | use App\Rules\UserEmailDomain; | ||||
use App\Rules\UserEmailLocal; | use App\Rules\UserEmailLocal; | ||||
use App\SignupCode; | use App\SignupCode; | ||||
use App\SignupInvitation; | use App\SignupInvitation; | ||||
use App\User; | use App\User; | ||||
use Illuminate\Http\Request; | use Illuminate\Http\Request; | ||||
use Illuminate\Support\Facades\DB; | use Illuminate\Support\Facades\DB; | ||||
use Illuminate\Support\Facades\Validator; | use Illuminate\Support\Facades\Validator; | ||||
▲ Show 20 Lines • Show All 350 Lines • ▼ Show 20 Lines | class SignupController extends Controller | ||||
* @return string Error message on validation error | * @return string Error message on validation error | ||||
*/ | */ | ||||
protected static function validatePhoneOrEmail($input, &$is_phone = false): ?string | protected static function validatePhoneOrEmail($input, &$is_phone = false): ?string | ||||
{ | { | ||||
$is_phone = false; | $is_phone = false; | ||||
$v = Validator::make( | $v = Validator::make( | ||||
['email' => $input], | ['email' => $input], | ||||
['email' => ['required', 'string', new ExternalEmail()]] | ['email' => ['required', 'string', new SignupExternalEmail()]] | ||||
); | ); | ||||
if ($v->fails()) { | if ($v->fails()) { | ||||
return $v->errors()->toArray()['email'][0]; | return $v->errors()->toArray()['email'][0]; | ||||
} | } | ||||
// TODO: Phone number support | // TODO: Phone number support | ||||
/* | /* | ||||
▲ Show 20 Lines • Show All 62 Lines • Show Last 20 Lines |