Skip to content

Commit

Permalink
for bonus task? with new branch
Browse files Browse the repository at this point in the history
  • Loading branch information
Sasha1256 committed Sep 26, 2024
1 parent 809f9c4 commit c03d5b9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ 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 UserService userService = new UserService();
public boolean login(String email, String password) {
UserService userService = new UserService();
User user = userService.findByEmail(email);
if (user != null) {
if (user.getPassword().equals(password)) {
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/mate/academy/service/UserService.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ public class UserService {
* Return <code>null</code> if there is no suitable user
*/
public User findByEmail(String email) {
for (User user:users
) {
for (User user:users) {
if (user.getEmail().equals(email)) {
return user;
}
Expand Down

0 comments on commit c03d5b9

Please sign in to comment.