MAPG-69 login user when trying to sign up

This commit is contained in:
bence committed 2020-06-21 15:12:45 +02:00
1 parent 10b7766458
commit 285f2dd0ac
3 files changed
+22 -11

No files matched your search

+12 -6
View File
@@ -190,22 +190,28 @@ class LoginController
return new JsonContent($data);
}
if (filter_var($this->request->post('email'), FILTER_VALIDATE_EMAIL) === false) {
$data = ['error' => 'email_not_valid'];
return new JsonContent($data);
}
$user = $this->userRepository->getByEmail($this->request->post('email'));
if ($user !== null) {
if ($user->getActive()) {
if (!$user->checkPassword($this->request->post('password'))) {
$data = ['error' => 'user_found_password_not_match'];
return new JsonContent($data);
}
$this->request->setUser($user);
$data = ['error' => 'user_found'];
} else {
$data = ['error' => 'not_active_user_found'];
$data = ['error' => 'user_found_user_not_active'];
}
return new JsonContent($data);
}
if (filter_var($this->request->post('email'), FILTER_VALIDATE_EMAIL) === false) {
$data = ['error' => 'email_not_valid'];
return new JsonContent($data);
}
if ($this->request->session()->has('tmp_user_data')) {
$tmpUserData = $this->request->session()->get('tmp_user_data');