Source:
public ServiceResponse<String> startPasswordReset(String username) { User user = userPersistence.selectUserByName(username); if (null == user) { return new ServiceResponse<>(StatusCodes.getStatusCode(StatusCodeType.MODEL_NOT_FOUND, new Object[]{USER, username})); } String code = generateCode(); authInfoPersistence.setOneTimePassword(user.getId(), code); boolean passwordSent = false; if (user.getContactMethods() != null) { for (ContactMethod selectedContactMethod : user.getContactMethods()) { if (selectedContactMethod.getConfirmed()) { if (ContactType.EMAIL.equals(selectedContactMethod.getContactType())) { String toAddress = selectedContactMethod.getContactValue(); String subject = "Password Reset For EdPanel"; String message = "Hello! Please login with this temporary password @ <LINK_0>\n" + "Your temporary password is ( " + code + " )"; emailService.sendMessage(toAddress, subject, message); } else if (ContactType.PHONE.equals(selectedContactMethod.getContactType())) { String toNumber = selectedContactMethod.getContactValue(); String msg = "Temp Password from EdPanel: " + code; textService.sendMessage(toNumber, msg); } else { logger.error("ERROR! Unknown enum type seen in switch statement in UserManagerImpl"); throw new UnsupportedOperationException("Cannot start contact validation for unknown contact type: " + selectedContactMethod.getContactType()); } passwordSent = true; break; } } } if (!passwordSent) { logger.info("Username " + user.getUsername() + " requested password reset but has no valid contact." + "\n The admin will now see this user's one-time password on their administration list."); } return new ServiceResponse<>(StatusCodes.getStatusCode(StatusCodeType.OK, new Object[]{"No Data"})); }

Target:
public ServiceResponse<String> startPasswordReset(String username) { User user = userPersistence.selectUserByName(username); if (null == user) { return new ServiceResponse<>(StatusCodes.getStatusCode(StatusCodeType.MODEL_NOT_FOUND, new Object[]{USER, username})); } String code = generateCode(); authInfoPersistence.setOneTimePassword(user.getId(), code); boolean passwordSent = false; if (user.getContactMethods() != null) { for (ContactMethod selectedContactMethod : user.getContactMethods()) { if (selectedContactMethod.getConfirmed()) { if (ContactType.EMAIL.equals(selectedContactMethod.getContactType())) { String toAddress = selectedContactMethod.getContactValue(); String subject = "Password Reset For EdPanel"; String message = "Hello! Please login with this temporary password @ <LINK_0>\n" + "Your username is " + user.getUsername() + " and " + "your temporary password is ( " + code + " )"; emailService.sendMessage(toAddress, subject, message); } else if (ContactType.PHONE.equals(selectedContactMethod.getContactType())) { String toNumber = selectedContactMethod.getContactValue(); String msg = "Temp Password from EdPanel: " + code; textService.sendMessage(toNumber, msg); } else { logger.error("ERROR! Unknown enum type seen in switch statement in UserManagerImpl"); throw new UnsupportedOperationException("Cannot start contact validation for unknown contact type: " + selectedContactMethod.getContactType()); } passwordSent = true; break; } } } if (!passwordSent) { logger.info("Username " + user.getUsername() + " requested password reset but has no valid contact." + "\n The admin will now see this user's one-time password on their administration list."); } return new ServiceResponse<>(StatusCodes.getStatusCode(StatusCodeType.OK, new Object[]{"No Data"})); }