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

methods login and findByEmail implemented #1159

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

Conversation

ira-levch
Copy link

No description provided.

Copy link

@liliia-ponomarenko liliia-ponomarenko 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! 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();

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 ;)

Copy link
Author

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?

Copy link
Author

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

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();

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();

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.

3 participants