Skip to content

Commit

Permalink
fixed AuthenticationService
Browse files Browse the repository at this point in the history
  • Loading branch information
ynik404 committed May 9, 2024
1 parent d20bd63 commit fb696c9
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions src/main/java/mate/academy/service/AuthenticationService.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
package mate.academy.service;

import mate.academy.model.User;

public class AuthenticationService {
private static final UserService AUTHENTICATION_SERVICE = new UserService();
private final 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 @@ -17,10 +15,6 @@ public class AuthenticationService {
*/

public boolean login(String email, String password) {
User userFromDb = AUTHENTICATION_SERVICE.findByEmail(email);
if (userFromDb == null) {
return false;
}
return userFromDb.getPassword().equals(password);
return userService.findByEmail(email).getPassword().equals(password);
}
}

0 comments on commit fb696c9

Please sign in to comment.