-
Notifications
You must be signed in to change notification settings - Fork 918
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
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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)
// import mate.academy.model.User; | ||
|
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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)
} | ||
} | ||
|
There was a problem hiding this comment.
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; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extra empty line
No description provided.