Skip to content

Commit

Permalink
Properly compare passwords when changing email address
Browse files Browse the repository at this point in the history
  • Loading branch information
micheljung committed May 16, 2018
1 parent bfbbeec commit b3a58cc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/main/java/com/faforever/api/user/UserService.java
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ private void createOrUpdateMauticContact(User user, String ipAddress) {
}

public void changeEmail(String currentPassword, String newEmail, User user, String ipAddress) {
if (!Objects.equals(user.getPassword(), passwordEncoder.encode(currentPassword))) {
if (!passwordEncoder.matches(currentPassword, user.getPassword())) {
throw new ApiException(new Error(ErrorCode.EMAIL_CHANGE_FAILED_WRONG_PASSWORD));
}

Expand Down

0 comments on commit b3a58cc

Please sign in to comment.