Skip to content

Commit

Permalink
reworked login method
Browse files Browse the repository at this point in the history
  • Loading branch information
Oleg021 committed Aug 4, 2024
1 parent 6566dfe commit 3df0f93
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/main/java/mate/academy/service/AuthenticationService.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package mate.academy.service;

import mate.academy.model.User;

public class AuthenticationService {
/**
* Imagine that some user wants to login to your site.
Expand All @@ -21,9 +23,7 @@ public void setUserService(UserService userService) {
}

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

0 comments on commit 3df0f93

Please sign in to comment.