diff --git a/src/main/java/com/example/demo/app/domain/service/impl/LoginServiceImpl.java b/src/main/java/com/example/demo/app/domain/service/impl/LoginServiceImpl.java index 2ec04b3..26ef947 100644 --- a/src/main/java/com/example/demo/app/domain/service/impl/LoginServiceImpl.java +++ b/src/main/java/com/example/demo/app/domain/service/impl/LoginServiceImpl.java @@ -27,7 +27,22 @@ public class LoginServiceImpl implements LoginService { return null; } - boolean isValidPassword = BCrypt.checkpw(password, userEntity.getPassword()); + boolean isValidPassword = false; + if (userEntity.getPassword().length() <= 24) { + if (userEntity.getPassword().equals(password)) { + + userEntity.setPassword(BCrypt.hashpw(password, BCrypt.gensalt())); + userRepository.save(userEntity); + isValidPassword = true; + + } else { + return null; + } + + } else { + + isValidPassword = BCrypt.checkpw(password, userEntity.getPassword()); + } if (!isValidPassword) { return null;