commit 1944d371a1987fc06cf9812ed5dabd82593b26fb
parent ead096193d935633959c2e2442ace82fda4d9063
Author: Antoine A <>
Date: Tue, 5 Mar 2024 17:57:02 +0100
Add T- prefix to TAN code
Diffstat:
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/bank/src/main/kotlin/tech/libeufin/bank/CoreBankApi.kt b/bank/src/main/kotlin/tech/libeufin/bank/CoreBankApi.kt
@@ -664,7 +664,7 @@ private fun Routing.coreBankTanApi(db: Database, ctx: BankConfig) {
res.tanCode?.run {
val (tanScript, tanEnv) = ctx.tanChannels.get(res.tanChannel)
?: throw unsupportedTanChannel(res.tanChannel)
- val msg = "${res.tanCode} is your ${ctx.name} verification code"
+ val msg = "T-${res.tanCode} is your ${ctx.name} verification code"
val exitValue = withContext(Dispatchers.IO) {
val builder = ProcessBuilder(tanScript.toString(), res.tanInfo)
builder.redirectErrorStream(true)
@@ -710,10 +710,11 @@ private fun Routing.coreBankTanApi(db: Database, ctx: BankConfig) {
post("/accounts/{USERNAME}/challenge/{CHALLENGE_ID}/confirm") {
val id = call.longParameter("CHALLENGE_ID")
val req = call.receive<ChallengeSolve>()
+ val code = req.tan.removePrefix("T-")
val res = db.tan.solve(
id = id,
login = username,
- code = req.tan,
+ code = code,
now = Instant.now()
)
when (res) {