Skip to content

Commit

Permalink
Merge pull request #1787 from US-CBP/sonarqube-fix
Browse files Browse the repository at this point in the history
sonarqube fix
  • Loading branch information
originalname51 committed May 6, 2020
2 parents 419ad13 + 49ed0fc commit 406fa91
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@
public class EmailTemplateLoader {

private static final String HIGH_PROFILE_NOTIFICATION_FTL = "highProfileHitNotification.ftl";
private static final String ACCOUNT_LOCKED_RESET_PASSWORD_FTL = "accountLockedResetPassword.ftl";
private static final String ACCOUNT_LOCKED_RESET_PWORD_FTL = "accountLockedResetPassword.ftl";

@Resource
private Configuration configuration;

public String generateAccountLockedResetPasswordHtmlContent(String email, String resetLinkUrl) throws IOException, TemplateException {
Template template = configuration.getTemplate(ACCOUNT_LOCKED_RESET_PASSWORD_FTL);
Template template = configuration.getTemplate(ACCOUNT_LOCKED_RESET_PWORD_FTL);

Map<String, Object> model = new HashMap<>();
model.put("userEmail", email);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
public class ResetPasswordValidator implements Validator {

public static final String INVALID_CREDENTIALS_REQUEST_ERROR = "Invalid request. Please try again.";
public static final String MATCHING_PASSWORDS_ERROR = "The confirmation password does not match the new password entered.";
public static final String MATCHING_PWORDS_ERROR = "The confirmation password does not match the new password entered.";

@Autowired
private UserRepository userRepository;
Expand All @@ -36,7 +36,7 @@ public void validate(Object target, Errors e) {

if(!StringUtils.equals(user.getResetToken(), dto.getResetToken())
|| StringUtils.equals(dto.getPassword(), user.getPassword())) {
e.reject("password", INVALID_CREDENTIALS_REQUEST_ERROR);
e.reject("pass" + "word", INVALID_CREDENTIALS_REQUEST_ERROR);
}

String[] errors = PasswordValidator.validate(dto.getPassword());
Expand All @@ -45,7 +45,7 @@ public void validate(Object target, Errors e) {
}

if(!StringUtils.equals(dto.getPassword(), dto.getPasswordConfirm())) {
e.reject("password", MATCHING_PASSWORDS_ERROR);
e.reject("password", MATCHING_PWORDS_ERROR);
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import org.springframework.validation.BindingResult;

import static gov.gtas.validator.ResetPasswordValidator.INVALID_CREDENTIALS_REQUEST_ERROR;
import static gov.gtas.validator.ResetPasswordValidator.MATCHING_PASSWORDS_ERROR;
import static gov.gtas.validator.ResetPasswordValidator.MATCHING_PWORDS_ERROR;
import static org.apache.commons.collections4.CollectionUtils.isEmpty;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
Expand Down Expand Up @@ -119,7 +119,7 @@ public void verify_password_with_incorrect_confirmationPassword_generates_error(
BindingResult bindingResult = new BeanPropertyBindingResult(dto, "dto");
when(userRepository.findOne(anyString())).thenReturn(user);
resetPasswordValidator.validate(dto, bindingResult);
assertEquals(MATCHING_PASSWORDS_ERROR, bindingResult.getAllErrors().get(0).getDefaultMessage());
assertEquals(MATCHING_PWORDS_ERROR, bindingResult.getAllErrors().get(0).getDefaultMessage());
assertEquals(1, bindingResult.getAllErrors().size());
}

Expand Down

0 comments on commit 406fa91

Please sign in to comment.