Merge pull request #1582 from pixelfed/frontend-ui-refactor

Update Auth controller
This commit is contained in:
daniel 2019-08-09 13:34:11 -06:00 committed by GitHub
commit 2dc22dc50c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 34 additions and 0 deletions

View file

@ -10,6 +10,7 @@ use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Validator; use Illuminate\Support\Facades\Validator;
use Illuminate\Auth\Events\Registered; use Illuminate\Auth\Events\Registered;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use App\Services\EmailService;
class RegisterController extends Controller class RegisterController extends Controller
{ {
@ -53,6 +54,8 @@ class RegisterController extends Controller
protected function validator(array $data) protected function validator(array $data)
{ {
$this->validateUsername($data['username']); $this->validateUsername($data['username']);
$this->validateEmail($data['email']);
$usernameRules = [ $usernameRules = [
'required', 'required',
'min:2', 'min:2',
@ -105,6 +108,14 @@ class RegisterController extends Controller
} }
} }
public function validateEmail($email)
{
$banned = EmailService::isBanned($email);
if($banned) {
return abort(403, 'Invalid email.');
}
}
/** /**
* Show the application registration form. * Show the application registration form.
* *

File diff suppressed because one or more lines are too long