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

HW2 #894

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

HW2 #894

wants to merge 3 commits into from

Conversation

idlt044
Copy link

@idlt044 idlt044 commented Jan 4, 2024

add code to Aunthentication Service and User Service

@idlt044
Copy link
Author

idlt044 commented Jan 4, 2024

add code to Aunthentication Service and User Service

Comment on lines 9 to 26
public static class User {
private final String email;
private final String password;

public User(String email, String password) {
this.email = email;
this.password = password;
}

public String getEmail() {
return email;
}

public String getPassword() {
return password;
}
}

Copy link

Choose a reason for hiding this comment

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

remove this, we already have user

@@ -11,6 +11,11 @@ public class AuthenticationService {
* Return false in any other cases.
*/
public boolean login(String email, String password) {
UserService userService = new UserService();
Copy link

Choose a reason for hiding this comment

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

make it a private class-level field

@@ -11,6 +11,11 @@ public class AuthenticationService {
* Return false in any other cases.
*/
public boolean login(String email, String password) {
UserService userService = new UserService();
UserService.User user = userService.findByEmail(email);
Copy link

Choose a reason for hiding this comment

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

Suggested change
UserService.User user = userService.findByEmail(email);
User user = userService.findByEmail(email);

Comment on lines 16 to 19
if (user != null && user.getPassword().equals(password)) {
return true;
}
return false;
Copy link

Choose a reason for hiding this comment

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

you can return condition directly ,without using true/false literals

@idlt044
Copy link
Author

idlt044 commented Jan 9, 2024

@idlt044 idlt044 requested a review from okuzan February 15, 2024 11:34
Comment on lines +18 to +19


Choose a reason for hiding this comment

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

Suggested change

return null;
}
}

Choose a reason for hiding this comment

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

Suggested change

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