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 & findByEmail methods #1101

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

Conversation

vDmytriv01
Copy link

No description provided.

* @param password - user's password
* @return true if user by email exists and passed password is equal to user's password.
* Return false in any other cases.
*/
public boolean login(String email, String password) {
User user = new UserService().findByEmail(email);

Choose a reason for hiding this comment

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

UserService should be class level variable

Comment on lines 18 to 21
if (user != null && user.getEmail().equals(email) && user.getPassword().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.

try to use one return and condition

* @param password - user's password
* @return true if user by email exists and passed password is equal to user's password.
* Return false in any other cases.
*/
private final 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.

  1. You have to declare variable before java doc for method
  2. It's better to use a constructor

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.

4 participants