Skip to content

Commit

Permalink
fix(Ebics User): store passphrase, not sig_passphrase
Browse files Browse the repository at this point in the history
  • Loading branch information
barredterra committed Nov 8, 2024
1 parent 9926047 commit ec79caf
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 15 deletions.
8 changes: 6 additions & 2 deletions banking/ebics/doctype/ebics_user/ebics_user.js
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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:"
);
Expand Down
16 changes: 8 additions & 8 deletions banking/ebics/doctype/ebics_user/ebics_user.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"user_id",
"needs_certificates",
"section_break_juzm",
"signature_passphrase",
"passphrase",
"keyring"
],
"fields": [
Expand Down Expand Up @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions banking/ebics/doctype/ebics_user/ebics_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
6 changes: 3 additions & 3 deletions banking/ebics/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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)
Expand Down

0 comments on commit ec79caf

Please sign in to comment.