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

add methods login and findByEmail 2 #605

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

TetianaDenchyk
Copy link

No description provided.

Copy link

@Andriy-dz Andriy-dz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job! Let's impove your solution)

Comment on lines 3 to 4
// import mate.academy.model.User;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please remove the commented code

@@ -11,6 +13,7 @@ public class AuthenticationService {
* Return false in any other cases.
*/
public boolean login(String email, String password) {
return false;
UserService member = new UserService();
return member.findByEmail(email) != null && member.findByPassword(password) != null;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is the logic here correct?) Can there be such a situation that the copier did not enter his password, but that password exists in the database with another user. In this case, your program will skip the user and it will not be very true. I suggest limiting yourself to one getByEmail method and getting the password from the User and comparing it with what was entered at the entrance)

}
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extra empty line

return null;
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extra empty line

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants