209. Testing in Production (#32)

This commit is contained in:
Art
2021-09-24 23:31:18 +03:00
parent 71016a4d35
commit f1001ce262
2 changed files with 11 additions and 4 deletions

View File

@ -165,6 +165,12 @@ WantedBy=multi-user.target
- `sudo systemctl status supportapi.service`
- To enable your service on every reboot
- `sudo systemctl enable supportapi.service`
#### 209. Testing in Production
- Test with:
- Username: `art.shyshkin`
- Password: `17aH!?o>CJ`
- and another
- Username: `shyshkin.art`
- Password: `5C<"0dVx=>`

View File

@ -153,6 +153,7 @@ public class UserServiceImpl implements UserService {
validateNewUsernameAndEmail(username, email);
String rawPassword = generatePassword();
log.debug("Added `{}` with Raw Password: {}", username, rawPassword);
String encodedPassword = passwordEncoder.encode(rawPassword);
User newUser = userMapper.toEntity(userDto);
@ -177,8 +178,8 @@ public class UserServiceImpl implements UserService {
private void saveProfileImage(User user, MultipartFile profileImage) {
if (profileImage == null) return;
if (!List.of(IMAGE_JPEG_VALUE, IMAGE_GIF_VALUE, IMAGE_PNG_VALUE).contains(profileImage.getContentType())){
throw new NotAnImageFileException(profileImage.getOriginalFilename()+ " is not an image file. Please upload an image");
if (!List.of(IMAGE_JPEG_VALUE, IMAGE_GIF_VALUE, IMAGE_PNG_VALUE).contains(profileImage.getContentType())) {
throw new NotAnImageFileException(profileImage.getOriginalFilename() + " is not an image file. Please upload an image");
}
Path userFolder = Paths.get(USER_FOLDER, user.getUserId());