-
Notifications
You must be signed in to change notification settings - Fork 937
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
methods login and findByEmail implemented #1159
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! One comment ;)
@@ -11,6 +13,8 @@ public class AuthenticationService { | |||
* Return false in any other cases. | |||
*/ | |||
public boolean login(String email, String password) { | |||
return false; | |||
UserService newService = new UserService(); |
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.
better make it a class-level variable ;)
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.
But in my code it is already made as a class-level variable:
public class AuthenticationService {
public boolean login(String email, String password) {
UserService newService = new UserService();
User user = newService.findByEmail(email);
return user != null && user.getPassword().equals(password);
}
}
Can you explain your comment in more details, please?
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.
I've understood th issue, please, disregard
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.
it means, that you shouldn't create UserService newService = new UserService();
in public boolean login(String email, String password)
, but create it as class-level variable
public class AuthenticationService {
private final UserService newService = new UserService();
@@ -11,6 +13,8 @@ public class AuthenticationService { | |||
* Return false in any other cases. | |||
*/ | |||
public boolean login(String email, String password) { | |||
return false; | |||
UserService newService = new UserService(); |
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.
it means, that you shouldn't create UserService newService = new UserService();
in public boolean login(String email, String password)
, but create it as class-level variable
public class AuthenticationService {
private final UserService newService = new UserService();
No description provided.