diff options
author | Antoine A <> | 2024-02-26 16:32:21 +0100 |
---|---|---|
committer | Antoine A <> | 2024-02-26 16:32:21 +0100 |
commit | fbb9d7a0011b461d07b3d411c79552331f976e95 (patch) | |
tree | add20ab8448d77155cceb95af1f00cf328ed406d | |
parent | 8e08920fcc91487ce923570e50159ba47dc6c3e9 (diff) | |
download | libeufin-fbb9d7a0011b461d07b3d411c79552331f976e95.tar.gz libeufin-fbb9d7a0011b461d07b3d411c79552331f976e95.tar.bz2 libeufin-fbb9d7a0011b461d07b3d411c79552331f976e95.zip |
Better TAN message
-rw-r--r-- | bank/src/main/kotlin/tech/libeufin/bank/CoreBankApi.kt | 5 | ||||
-rw-r--r-- | bank/src/test/kotlin/helpers.kt | 5 |
2 files changed, 5 insertions, 5 deletions
diff --git a/bank/src/main/kotlin/tech/libeufin/bank/CoreBankApi.kt b/bank/src/main/kotlin/tech/libeufin/bank/CoreBankApi.kt index c2efaf76..e656bc7b 100644 --- a/bank/src/main/kotlin/tech/libeufin/bank/CoreBankApi.kt +++ b/bank/src/main/kotlin/tech/libeufin/bank/CoreBankApi.kt @@ -1,6 +1,6 @@ /* * This file is part of LibEuFin. - * Copyright (C) 2023 Taler Systems S.A. + * Copyright (C) 2023-2024 Taler Systems S.A. * LibEuFin is free software; you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as @@ -663,6 +663,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 bank verification code" val exitValue = withContext(Dispatchers.IO) { val builder = ProcessBuilder(tanScript.toString(), res.tanInfo) builder.redirectErrorStream(true) @@ -671,7 +672,7 @@ private fun Routing.coreBankTanApi(db: Database, ctx: BankConfig) { } val process = builder.start() try { - process.outputWriter().use { it.write(res.tanCode) } + process.outputWriter().use { it.write(msg) } process.onExit().await() } catch (e: Exception) { process.destroy() diff --git a/bank/src/test/kotlin/helpers.kt b/bank/src/test/kotlin/helpers.kt index e0378d42..b50b5e00 100644 --- a/bank/src/test/kotlin/helpers.kt +++ b/bank/src/test/kotlin/helpers.kt @@ -1,6 +1,6 @@ /* * This file is part of LibEuFin. - * Copyright (C) 2023 Taler Systems S.A. + * Copyright (C) 2023-2024 Taler Systems S.A. * LibEuFin is free software; you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as @@ -189,7 +189,6 @@ suspend fun ApplicationTestBuilder.tanInfo(account: String): Pair<TanChannel?, S TanChannel.sms -> res.contact_data!!.phone.get() TanChannel.email -> res.contact_data!!.email.get() null -> null - else -> null }) } @@ -304,7 +303,7 @@ suspend fun ApplicationTestBuilder.convert(amount: String): TalerAmount { suspend fun tanCode(info: String): String? { try { val file = Path("/tmp/tan-$info.txt") - val code = file.readText() + val code = file.readText().split(" ", limit=2).first() file.deleteExisting() return code } catch (e: Exception) { |