Skip to content

Commit

Permalink
solution-number2builded
Browse files Browse the repository at this point in the history
  • Loading branch information
aunkerrr committed Aug 3, 2024
1 parent 43c0113 commit dab3a77
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/main/java/mate/academy/service/AuthenticationService.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,21 @@
import mate.academy.model.User;

public class AuthenticationService {
private UserService userServiece = 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.
* All users are stored in <code>UserService</code> class.
* @param email - user's email
*
* @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.
*/

public boolean login(String email, String password) {
User user = userServiece.findByEmail(email);
User user = userService.findByEmail(email);
return user != null && user.getPassword().equals(password);
}
}

0 comments on commit dab3a77

Please sign in to comment.