Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
package co.nilin.opex.api.core.inout

data class TempOtpResponse(val otp: String, var receivers: List<OTPReceiver>? = null)
data class TempOtpResponse(val otp: String?, var receivers: List<OTPReceiver>? = null)
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ data class OTPVerifyResponse(
)

//TODO IMPORTANT: remove in production
data class TempOtpResponse(val otp: String, val otpReceiver: OTPReceiver?)
data class TempOtpResponse(val otp: String?, val otpReceiver: OTPReceiver?)

enum class OTPAction {
REGISTER, FORGET, NONE
Expand Down
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -545,6 +545,7 @@ services:
- SMTP_PASS=${SMTP_PASS}
- SMTP_FROM=${SMTP_FROM}
- TOKEN_ISSUER_URL=${KC_ISSUER_URL}
- OTP_CODE_RESPONSE_ENABLED=${OTP_CODE_RESPONSE_ENABLED}
depends_on:
- consul
- postgres-otp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import co.nilin.opex.otp.app.data.OTPResult
import co.nilin.opex.otp.app.data.VerifyOTPRequest
import co.nilin.opex.otp.app.model.OTPType
import co.nilin.opex.otp.app.service.OTPService
import org.springframework.beans.factory.annotation.Value
import org.springframework.http.HttpStatus
import org.springframework.http.ResponseEntity
import org.springframework.web.bind.annotation.PostMapping
Expand All @@ -15,10 +16,13 @@ import org.springframework.web.bind.annotation.RestController

@RestController
@RequestMapping("/v1/otp")
class OTPController(private val otpService: OTPService) {
class OTPController(
private val otpService: OTPService,
@Value("\${otp.response-enabled}") private val otpCodeResponseEnabled: Boolean,
) {

//TODO IMPORTANT: remove in production
data class TempOtpResponse(val otp: String)
data class TempOtpResponse(val otp: String?)
//TODO IMPORTANT: remove in production

//TODO IMPORTANT: remove in production
Expand All @@ -34,7 +38,8 @@ class OTPController(private val otpService: OTPService) {
)
else
otpService.requestCompositeOTP(request.receivers.toSet(), request.userId, request.action)
return ResponseEntity.status(HttpStatus.CREATED).body(TempOtpResponse(code))
val tempOtpResponse = if (otpCodeResponseEnabled) code else null
return ResponseEntity.status(HttpStatus.CREATED).body(TempOtpResponse(tempOtpResponse))
}

@PostMapping("/verify")
Expand Down
1 change: 1 addition & 0 deletions otp/otp-app/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ app:
cert-url: http://keycloak:8080/realms/opex/protocol/openid-connect/certs
iss-url: ${TOKEN_ISSUER_URL:http://keycloak:8080/realms/opex}
otp:
response-enabled: ${OTP_CODE_RESPONSE_ENABLED:false}
sms:
provider:
url: ${SMS_PROVIDER_URL}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
package co.nilin.opex.profile.core.data.otp

data class TempOtpResponse(val otp: String, var otpReceiver: OTPReceiver?)
data class TempOtpResponse(val otp: String?, var otpReceiver: OTPReceiver?)
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class WalletSnapshotService(
}
}

@Scheduled(cron = "0 40 16 * * ?", zone = "GMT" + "\${app.zone-offset}")
@Scheduled(cron = "0 0 0 * * ?", zone = "GMT" + "\${app.zone-offset}")
fun createDetailAssetsSnapshot() {
runBlocking {
updatePrices()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
package co.nilin.opex.wallet.core.inout.otp

data class TempOtpResponse(val otp: String, var receivers: List<OTPReceiver>? = null)
data class TempOtpResponse(val otp: String?, var receivers: List<OTPReceiver>? = null)
Loading