fix decrypt password

This commit is contained in:
dirgantarasiahaan
2023-05-28 17:36:28 +07:00
parent cab86cf8fa
commit c93f666056
77 changed files with 405 additions and 129 deletions

View File

@@ -7,18 +7,17 @@ import com.iconplus.smartproc.helper.model.EmptyResponse;
import com.iconplus.smartproc.helper.service.BaseService;
import com.iconplus.smartproc.model.entity.TokenManagement;
import com.iconplus.smartproc.repository.TokenManagementRepository;
import com.iconplus.smartproc.repository.UsersRepository;
import org.springframework.beans.factory.annotation.Autowired;
import com.iconplus.smartproc.util.Constants;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class LogoutService implements BaseService<EmptyRequest, EmptyResponse> {
private ApiContext apiContext;
private TokenManagementRepository tokenManagementRepository;
private LogoutService(ApiContext apiContext,
public LogoutService(ApiContext apiContext,
TokenManagementRepository tokenManagementRepository) {
this.apiContext = apiContext;
this.tokenManagementRepository = tokenManagementRepository;
@@ -35,10 +34,10 @@ public class LogoutService implements BaseService<EmptyRequest, EmptyResponse> {
}
private TokenManagement getTokenManagement(String accessToken) {
var tokenManagement = tokenManagementRepository.findByAccessTokenAndIsDeleteFalse(accessToken);
if (tokenManagement.isEmpty()) {
throw new BusinessException("err", "err", "err");
}
return tokenManagement.get();
return tokenManagementRepository.findByAccessTokenAndIsDeleteFalse(accessToken)
.orElseThrow(() -> new BusinessException(HttpStatus.CONFLICT,
Constants.ERR_CODE_40038,
Constants.ERR_TITLE_40038,
Constants.ERR_MESSAGE_40038));
}
}