From ec79caf8b8acb0d8cf43d1caf162ca589d82b64b Mon Sep 17 00:00:00 2001 From: barredterra <14891507+barredterra@users.noreply.github.com> Date: Fri, 8 Nov 2024 18:23:38 +0100 Subject: [PATCH] fix(Ebics User): store passphrase, not sig_passphrase --- banking/ebics/doctype/ebics_user/ebics_user.js | 8 ++++++-- banking/ebics/doctype/ebics_user/ebics_user.json | 16 ++++++++-------- banking/ebics/doctype/ebics_user/ebics_user.py | 4 ++-- banking/ebics/utils.py | 6 +++--- 4 files changed, 19 insertions(+), 15 deletions(-) diff --git a/banking/ebics/doctype/ebics_user/ebics_user.js b/banking/ebics/doctype/ebics_user/ebics_user.js index 51a2596b..14d02a71 100644 --- a/banking/ebics/doctype/ebics_user/ebics_user.js +++ b/banking/ebics/doctype/ebics_user/ebics_user.js @@ -12,13 +12,13 @@ frappe.ui.form.on("EBICS User", { fieldname: "passphrase", label: __("Passphrase"), fieldtype: "Password", - description: __("Set a new password for uploading transactions to your bank.") + description: __("Set a new password for downloading bank statements from your bank. This one will be stored in ERPNext.") }, { fieldname: "signature_passphrase", label: __("Signature Passphrase"), fieldtype: "Password", - description: __("Set a new password for downloading bank statements from your bank. This one will be stored in ERPNext.") + description: __("Set a new password for uploading transactions to your bank.") }, { fieldname: "info", @@ -48,6 +48,10 @@ frappe.ui.form.on("EBICS User", { __("Verify Bank Keys"), async () => { bank_keys = await get_bank_keys(frm.doc.name); + if (!bank_keys) { + return; + } + message = __( "Please confirm that the following keys are identical to the ones mentioned on your bank's letter:" ); diff --git a/banking/ebics/doctype/ebics_user/ebics_user.json b/banking/ebics/doctype/ebics_user/ebics_user.json index 6d2f009a..45fa3bbf 100644 --- a/banking/ebics/doctype/ebics_user/ebics_user.json +++ b/banking/ebics/doctype/ebics_user/ebics_user.json @@ -17,7 +17,7 @@ "user_id", "needs_certificates", "section_break_juzm", - "signature_passphrase", + "passphrase", "keyring" ], "fields": [ @@ -98,22 +98,22 @@ "fieldtype": "Section Break" }, { - "fieldname": "signature_passphrase", - "fieldtype": "Password", - "label": "Signature Passphrase", + "fieldname": "keyring", + "fieldtype": "Code", + "label": "Keyring", "no_copy": 1, "read_only": 1 }, { - "fieldname": "keyring", - "fieldtype": "Code", - "label": "Keyring", + "fieldname": "passphrase", + "fieldtype": "Password", + "label": "Passphrase", "no_copy": 1, "read_only": 1 } ], "links": [], - "modified": "2024-11-08 17:08:32.763328", + "modified": "2024-11-08 18:14:08.305413", "modified_by": "Administrator", "module": "EBICS", "name": "EBICS User", diff --git a/banking/ebics/doctype/ebics_user/ebics_user.py b/banking/ebics/doctype/ebics_user/ebics_user.py index f5853d54..24eba8c9 100644 --- a/banking/ebics/doctype/ebics_user/ebics_user.py +++ b/banking/ebics/doctype/ebics_user/ebics_user.py @@ -102,10 +102,10 @@ def initialize(ebics_user: str, passphrase: str, signature_passphrase: str): user = frappe.get_doc("EBICS User", ebics_user) user.check_permission("write") - user.signature_passphrase = signature_passphrase + user.passphrase = passphrase user.save() - manager = get_ebics_manager(user, passphrase) + manager = get_ebics_manager(user, signature_passphrase) try: manager.create_user_keys() diff --git a/banking/ebics/utils.py b/banking/ebics/utils.py index c75e9c3b..3ff1d4a6 100644 --- a/banking/ebics/utils.py +++ b/banking/ebics/utils.py @@ -11,7 +11,7 @@ from banking.ebics.doctype.ebics_user.ebics_user import EBICSUser -def get_ebics_manager(ebics_user: "EBICSUser", passphrase: str | None = None) -> "EBICSManager": +def get_ebics_manager(ebics_user: "EBICSUser", sig_passphrase: str | None = None) -> "EBICSManager": """Get an EBICSManager instance for the given EBICS User. :param ebics_user: The EBICS User record. @@ -27,8 +27,8 @@ def get_ebics_manager(ebics_user: "EBICSUser", passphrase: str | None = None) -> manager.set_keyring( keys=ebics_user.get_keyring(), save_to_db=ebics_user.store_keyring, - sig_passphrase=ebics_user.get_password("signature_passphrase"), - passphrase=passphrase, + sig_passphrase=sig_passphrase, + passphrase=ebics_user.get_password("passphrase"), ) manager.set_user(ebics_user.partner_id, ebics_user.user_id)