check email/username syntax before sending it to db
mapguesser/pipeline/pr-develop This commit looks good
mapguesser/pipeline/pr-develop This commit looks good
This commit is contained in:
1 file changed
+14
@@ -157,6 +157,13 @@ class LoginController
|
|||||||
return new JsonContent(['success' => true]);
|
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'));
|
$user = $this->userRepository->getByEmailOrUsername(\Container::$request->post('email'));
|
||||||
|
|
||||||
if ($user === null) {
|
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'));
|
$user = $this->userRepository->getByEmailOrUsername(\Container::$request->post('email'));
|
||||||
|
|
||||||
if ($user === null) {
|
if ($user === null) {
|
||||||
|
|||||||
Reference in new issue
Block a user