feature/accept-email-and-username-in-forms #77

Merged
bence merged 3 commits from feature/accept-email-and-username-in-forms into develop 2023-09-26 00:44:56 +02:00
Showing only changes of commit 0a7d248a3e - Show all commits

View File

@ -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) {