Skip to content

Commit

Permalink
fixed-3
Browse files Browse the repository at this point in the history
  • Loading branch information
DmitryShmerchuk committed Nov 17, 2024
1 parent 689c4c0 commit 81d1ba5
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions src/main/java/mate/academy/service/AuthenticationService.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,15 @@
import mate.academy.model.User;

public class AuthenticationService {
/**
* Imagine that some user wants to login to your site.
* You should check if user credentials (login and password) are valid or not.
* All users are stored in <code>UserService</code> class.
* @param email - user's email
* @param password - user's password
* @return true if user by email exists and passed password is equal to user's password.
* Return false in any other cases.
*/

private final UserService userService;

public AuthenticationService() {
this.userService = new UserService();
}

public boolean login(String email, String password) {
User user = new UserService().findByEmail(email);
User user = userService.findByEmail(email);
if (user == null) {
return false;
}
Expand Down

0 comments on commit 81d1ba5

Please sign in to comment.