Skip to content

Commit

Permalink
added fix to the login method
Browse files Browse the repository at this point in the history
  • Loading branch information
Dymchenko, Mykola committed Oct 1, 2024
1 parent ee54a60 commit 9e392d2
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/main/java/mate/academy/service/AuthenticationService.java
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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;
}
}
Expand Down

0 comments on commit 9e392d2

Please sign in to comment.