From df8530117cbe2ffb8a7414958f98b927216512f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gregor=20D=C3=BCster?= Date: Mon, 30 Sep 2024 17:25:58 +0200 Subject: [PATCH] fixup! Enable import from bank account if TAN is required after login --- web/blueprints/finance/__init__.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/web/blueprints/finance/__init__.py b/web/blueprints/finance/__init__.py index e28f34de7..34a8db617 100644 --- a/web/blueprints/finance/__init__.py +++ b/web/blueprints/finance/__init__.py @@ -9,6 +9,7 @@ :copyright: (c) 2012 by AG DSN. """ +import logging import typing as t from base64 import b64encode, b64decode from decimal import Decimal @@ -147,6 +148,7 @@ bp = Blueprint('finance', __name__) access = BlueprintAccess(bp, required_properties=['finance_show']) nav = BlueprintNavigation(bp, "Finanzen", icon='fa-euro-sign', blueprint_access=access) +logger = logging.getLogger(__name__) @bp.route('/') @@ -269,11 +271,16 @@ def bank_accounts_login(bank_account_id: int, action: str) -> ResponseReturnValu mechanisms = client.get_tan_mechanisms() if "913" in mechanisms: - client.set_tan_mechanism("913") # QR-Code - elif "910" in mechanisms: - client.set_tan_mechanism("910") # Manual + client.set_tan_mechanism("913") # chipTAN-QR else: - raise ValueError("We don't like any of the mechanisms.") + logger.error("FinTS: No suitable TAN mechanism available.", exc_info=True) + flash( + f"TAN-Verfahren „chipTAN-QR“ wird benötigt, jedoch sind am FinTS-Endpunkt nur folgende Verfahren verfügbar: {', '.join(m.name for m in mechanisms.values())}.", + "error", + ) + return redirect( + url_for(".bank_accounts_login", bank_account_id=bank_account_id, action=action) + ) with client: if client.init_tan_response: