-
Notifications
You must be signed in to change notification settings - Fork 931
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
base: master
Are you sure you want to change the base?
implement login method #1123
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.
|
||
private final UserService userService; | ||
|
||
public AuthenticationService(UserService userService) { | ||
this.userService = 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.
private final UserService userService; | |
public AuthenticationService(UserService userService) { | |
this.userService = userService; | |
} | |
private final UserService userService = 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.
fixed
if (user == null) { | ||
return false; | ||
} | ||
String userPassword = user.getPassword(); | ||
if (userPassword.equals(password)) { | ||
return true; | ||
} | ||
return false; |
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.
if (user == null) { | |
return false; | |
} | |
String userPassword = user.getPassword(); | |
if (userPassword.equals(password)) { | |
return true; | |
} | |
return false; | |
return user != null && user.getPassword().equals(password); |
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.
fixed
src/main/java/mate/academy/Main.java
Outdated
@@ -1,9 +1,10 @@ | |||
package mate.academy; | |||
|
|||
import mate.academy.service.AuthenticationService; | |||
import mate.academy.service.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.
remove import
import mate.academy.service.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.
fixed
src/main/java/mate/academy/Main.java
Outdated
|
||
public class Main { | ||
private static final AuthenticationService authenticationService = new AuthenticationService(); | ||
private static final AuthenticationService authenticationService = new AuthenticationService(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.
private static final AuthenticationService authenticationService = new AuthenticationService(new UserService()); | |
private static final AuthenticationService authenticationService = new AuthenticationService(); |
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.
fixed
@@ -5,7 +5,7 @@ | |||
public class UserService { | |||
private static final User[] users = new User[] { | |||
new User("[email protected]", "1234"), | |||
new User("[email protected]", "1234") | |||
new User("[email protected]", "1234"), |
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.
remove comma
new User("[email protected]", "1234"), | |
new User("[email protected]", "1234") |
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.
fixed
No description provided.