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

implement login method #1123

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

Conversation

pMukuta
Copy link

@pMukuta pMukuta commented Oct 23, 2024

No description provided.

Copy link

@Elena-Bruyako Elena-Bruyako left a comment

Choose a reason for hiding this comment

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

build failed, fix it

Screenshot 2024-10-23 at 20 35 21

Comment on lines 6 to 13

private final UserService userService;

public AuthenticationService(UserService userService) {
this.userService = userService;
}


Choose a reason for hiding this comment

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

Suggested change
private final UserService userService;
public AuthenticationService(UserService userService) {
this.userService = userService;
}
private final UserService userService = new UserService();

Copy link
Author

Choose a reason for hiding this comment

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

fixed

Comment on lines 25 to 32
if (user == null) {
return false;
}
String userPassword = user.getPassword();
if (userPassword.equals(password)) {
return true;
}
return false;

Choose a reason for hiding this comment

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

Suggested change
if (user == null) {
return false;
}
String userPassword = user.getPassword();
if (userPassword.equals(password)) {
return true;
}
return false;
return user != null && user.getPassword().equals(password);

Copy link
Author

Choose a reason for hiding this comment

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

fixed

@@ -1,9 +1,10 @@
package mate.academy;

import mate.academy.service.AuthenticationService;
import mate.academy.service.UserService;

Choose a reason for hiding this comment

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

remove import

Suggested change
import mate.academy.service.UserService;

Copy link
Author

Choose a reason for hiding this comment

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

fixed


public class Main {
private static final AuthenticationService authenticationService = new AuthenticationService();
private static final AuthenticationService authenticationService = new AuthenticationService(new UserService());

Choose a reason for hiding this comment

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

Suggested change
private static final AuthenticationService authenticationService = new AuthenticationService(new UserService());
private static final AuthenticationService authenticationService = new AuthenticationService();

Copy link
Author

Choose a reason for hiding this comment

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

fixed

@@ -5,7 +5,7 @@
public class UserService {
private static final User[] users = new User[] {
new User("bob@i.ua", "1234"),
new User("alice@i.ua", "1234")
new User("alice@i.ua", "1234"),

Choose a reason for hiding this comment

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

remove comma

Suggested change
new User("alice@i.ua", "1234"),
new User("alice@i.ua", "1234")

Copy link
Author

Choose a reason for hiding this comment

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

fixed

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