Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jv oop lesson 0 #731

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
move userService field to class level
  • Loading branch information
rk0v committed Oct 17, 2023
commit b604a3d9003476a8624bf524d4ce8030bf9e3f5d
5 changes: 3 additions & 2 deletions src/main/java/mate/academy/service/AuthenticationService.java
Original file line number Diff line number Diff line change
@@ -13,9 +13,10 @@ public class AuthenticationService {
* @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 = new UserService();

public boolean login(String email, String password) {
UserService userService = new UserService();
User user = userService.findByEmail(email);
return user != null && user.getEmail().equals(email) && user.getPassword().equals(password);
return user != null && user.getPassword().equals(password);
}
}
2 changes: 1 addition & 1 deletion src/main/java/mate/academy/service/UserService.java
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@
import mate.academy.model.User;

public class UserService {
protected static final User[] users = new User[]{
private static final User[] users = new User[]{
new User("bob@i.ua", "1234"),
new User("alice@i.ua", "1234")
};