feature/accept-email-and-username-in-forms #77
@ -157,6 +157,13 @@ class LoginController
|
||||
return new JsonContent(['success' => true]);
|
||||
}
|
||||
|
||||
if (
|
||||
filter_var(\Container::$request->post('email'), FILTER_VALIDATE_EMAIL) === false &&
|
||||
preg_match('/^[a-zA-Z0-9_\-\.]+$/', \Container::$request->post('email')) !== 1
|
||||
) {
|
||||
return new JsonContent(['error' => ['errorText' => 'This is not a valid email address or username.']]);
|
||||
}
|
||||
|
||||
$user = $this->userRepository->getByEmailOrUsername(\Container::$request->post('email'));
|
||||
|
||||
if ($user === null) {
|
||||
@ -500,6 +507,13 @@ class LoginController
|
||||
}
|
||||
}
|
||||
|
||||
if (
|
||||
filter_var(\Container::$request->post('email'), FILTER_VALIDATE_EMAIL) === false &&
|
||||
preg_match('/^[a-zA-Z0-9_\-\.]+$/', \Container::$request->post('email')) !== 1
|
||||
) {
|
||||
return new JsonContent(['error' => ['errorText' => 'This is not a valid email address or username.']]);
|
||||
}
|
||||
|
||||
$user = $this->userRepository->getByEmailOrUsername(\Container::$request->post('email'));
|
||||
|
||||
if ($user === null) {
|
||||
|
Loading…
Reference in New Issue
Block a user