Skip to content

Commit

Permalink
Drop Anope update on password reset
Browse files Browse the repository at this point in the history
  • Loading branch information
Brutus5000 committed Dec 1, 2023
1 parent c92acd8 commit aa9176b
Show file tree
Hide file tree
Showing 6 changed files with 0 additions and 54 deletions.
Expand Up @@ -43,9 +43,6 @@ public class UsersControllerTest extends AbstractIntegrationTest {
private static final String NEW_PASSWORD = "newPassword";
private static final String NEW_EMAIL = "test@faforever.com";

@MockBean
private AnopeUserRepository anopeUserRepository;

@MockBean
private EmailSender emailSender;

Expand Down Expand Up @@ -124,7 +121,6 @@ public void changePasswordWithSuccess() throws Exception {

User user = userRepository.getById(USERID_USER);
assertEquals(user.getPassword(), "5c29a959abce4eda5f0e7a4e7ea53dce4fa0f0abbe8eaa63717e2fed5f193d31");
verify(anopeUserRepository, times(1)).updatePassword(eq(AUTH_USER), anyString());
}

@Test
Expand Down
Expand Up @@ -36,7 +36,6 @@ public class FafApiProperties {
private Challonge challonge = new Challonge();
private User user = new User();
private Database database = new Database();
private Anope anope = new Anope();
private Rating rating = new Rating();
private Tutorial tutorial = new Tutorial();
private Nodebb nodebb = new Nodebb();
Expand Down
33 changes: 0 additions & 33 deletions src/main/java/com/faforever/api/user/AnopeUserRepository.java

This file was deleted.

7 changes: 0 additions & 7 deletions src/main/java/com/faforever/api/user/UserService.java
Expand Up @@ -14,7 +14,6 @@
import com.faforever.api.security.FafTokenService;
import com.faforever.api.security.FafTokenType;
import com.faforever.api.security.FafUserAuthenticationToken;
import com.google.common.hash.Hashing;
import io.micrometer.core.instrument.Counter;
import io.micrometer.core.instrument.MeterRegistry;
import lombok.extern.slf4j.Slf4j;
Expand All @@ -25,7 +24,6 @@
import org.springframework.transaction.annotation.Transactional;

import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.time.Duration;
import java.util.ArrayList;
import java.util.Arrays;
Expand Down Expand Up @@ -59,7 +57,6 @@ public class UserService {
private final NameRecordRepository nameRecordRepository;
private final FafApiProperties properties;
private final FafPasswordEncoder passwordEncoder;
private final AnopeUserRepository anopeUserRepository;
private final FafTokenService fafTokenService;
private final SteamService steamService;
private final GogService gogService;
Expand All @@ -84,7 +81,6 @@ public UserService(EmailService emailService,
AccountLinkRepository accountLinkRepository,
NameRecordRepository nameRecordRepository,
FafApiProperties properties,
AnopeUserRepository anopeUserRepository,
FafTokenService fafTokenService,
SteamService steamService,
GogService gogService,
Expand All @@ -96,7 +92,6 @@ public UserService(EmailService emailService,
this.accountLinkRepository = accountLinkRepository;
this.nameRecordRepository = nameRecordRepository;
this.properties = properties;
this.anopeUserRepository = anopeUserRepository;
this.fafTokenService = fafTokenService;
this.steamService = steamService;
this.gogService = gogService;
Expand Down Expand Up @@ -343,8 +338,6 @@ private void setPassword(User user, String password) {
log.debug("Updating FAF password for user: {}", user.getLogin());
user.setPassword(passwordEncoder.encode(password));
userRepository.save(user);
log.debug("Updating anope password for user: {}", user.getLogin());
anopeUserRepository.updatePassword(user.getLogin(), Hashing.md5().hashString(password, StandardCharsets.UTF_8).toString());
}

public User getUser(Authentication authentication) {
Expand Down
2 changes: 0 additions & 2 deletions src/main/resources/config/application.yml
@@ -1,7 +1,5 @@
faf-api:
version: #faf-api.version#
anope:
database-name: ${ANOPE_DATABASE_NAME:faf-anope}
avatar:
max-size-bytes: ${AVATAR_MAX_SIZE_BYTES:4096}
image-width: ${AVATAR_IMAGE_WIDTH:40}
Expand Down
7 changes: 0 additions & 7 deletions src/test/java/com/faforever/api/user/UserServiceTest.java
Expand Up @@ -14,7 +14,6 @@
import com.faforever.api.security.FafTokenService;
import com.faforever.api.security.FafTokenType;
import com.faforever.api.user.UserService.CallbackResult;
import com.google.common.hash.Hashing;
import io.micrometer.core.instrument.MeterRegistry;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
Expand All @@ -28,7 +27,6 @@
import org.springframework.context.ApplicationEventPublisher;

import java.math.BigInteger;
import java.nio.charset.StandardCharsets;
import java.time.Duration;
import java.util.Map;
import java.util.Optional;
Expand Down Expand Up @@ -83,8 +81,6 @@ public class UserServiceTest {
@Mock
private NameRecordRepository nameRecordRepository;
@Mock
private AnopeUserRepository anopeUserRepository;
@Mock
private SteamService steamService;
@Mock
private GogService gogService;
Expand Down Expand Up @@ -119,7 +115,6 @@ public void setUp() {
accountLinkRepository,
nameRecordRepository,
properties,
anopeUserRepository,
fafTokenService,
steamService,
gogService,
Expand Down Expand Up @@ -207,7 +202,6 @@ public void changePassword() {
ArgumentCaptor<User> captor = ArgumentCaptor.forClass(User.class);
verify(userRepository).save(captor.capture());
assertEquals(captor.getValue().getPassword(), fafPasswordEncoder.encode(TEST_NEW_PASSWORD));
verify(anopeUserRepository).updatePassword(TEST_USERNAME, Hashing.md5().hashString(TEST_NEW_PASSWORD, StandardCharsets.UTF_8).toString());

verifyNoMoreInteractions(eventPublisher);
}
Expand Down Expand Up @@ -403,7 +397,6 @@ public void claimPasswordResetToken() {
ArgumentCaptor<User> captor = ArgumentCaptor.forClass(User.class);
verify(userRepository).save(captor.capture());
assertEquals(captor.getValue().getPassword(), fafPasswordEncoder.encode(TEST_NEW_PASSWORD));
verify(anopeUserRepository).updatePassword(TEST_USERNAME, Hashing.md5().hashString(TEST_NEW_PASSWORD, StandardCharsets.UTF_8).toString());
verifyNoMoreInteractions(eventPublisher);
}

Expand Down

0 comments on commit aa9176b

Please sign in to comment.