From 9e392d2e228774669e48f6b14b44763bc22dc74c Mon Sep 17 00:00:00 2001 From: "Dymchenko, Mykola" Date: Tue, 1 Oct 2024 05:40:02 -0500 Subject: [PATCH] added fix to the login method --- .../java/mate/academy/service/AuthenticationService.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/mate/academy/service/AuthenticationService.java b/src/main/java/mate/academy/service/AuthenticationService.java index 7059c918..ad66176d 100644 --- a/src/main/java/mate/academy/service/AuthenticationService.java +++ b/src/main/java/mate/academy/service/AuthenticationService.java @@ -3,7 +3,7 @@ import mate.academy.model.User; public class AuthenticationService { - UserService userService = new UserService(); + private UserService userService = new UserService(); /** * Imagine that some user wants to login to your site. * You should check if user credentials (login and password) are valid or not. @@ -13,12 +13,12 @@ public class AuthenticationService { * @return true if user by email exists and passed password is equal to user's password. * Return false in any other cases. */ + public boolean login(String email, String password) { User userByEmail = userService.findByEmail(email); if (userByEmail != null) { - if (userByEmail.getEmail().equals(email) - && userByEmail.getPassword().equals(password)) { + if (userByEmail.getPassword().equals(password)) { return true; } }