Skip to content

Commit

Permalink
fix: fix login method's unnecessary String casting of char[] argument
Browse files Browse the repository at this point in the history
  • Loading branch information
Fredrik Marjoni committed Mar 5, 2026
1 parent 07dd8af commit f81c347
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/main/java/edu/group5/app/model/user/UserService.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,15 @@ public boolean registerUser(String role, String firstName, String lastName,
return true;
}

public boolean login(String email, char[] password) {
public boolean login(String email, String password) {
if (email == null || email.trim().isEmpty() || password == null) {
return false;
}
User user = userRepository.findByEmail(email);
if (user == null) {
return false;
}
String passwordString = new String(password);
if (user.verifyPassword(passwordString)) {
if (user.verifyPassword(password)) {
return true;
}
return false;
Expand Down

0 comments on commit f81c347

Please sign in to comment.