Skip to content

Commit

Permalink
changes made
Browse files Browse the repository at this point in the history
  • Loading branch information
BohdanZorii committed Jan 23, 2024
1 parent fdd275b commit 71b47cb
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/main/java/mate/academy/service/AuthenticationService.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import mate.academy.model.User;

public class AuthenticationService {
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 +14,8 @@ public class AuthenticationService {
* Return false in any other cases.
*/
public boolean login(String email, String password) {
UserService userService = new UserService();
User user = userService.findByEmail(email);

if (user == null) {
return false;
}
return user.getPassword().equals(password);
return user != null && user.getPassword().equals(password); //
}
}

0 comments on commit 71b47cb

Please sign in to comment.