From 3c18c236bcad880f4dff26a9cdbe9790f4330a89 Mon Sep 17 00:00:00 2001 From: Luc De Meyer Date: Sun, 28 May 2023 10:48:17 +0200 Subject: [PATCH] [FIX][16.0]fix change passphrase for non-stored paspphrase --- account_ebics/README.rst | 2 +- account_ebics/wizards/ebics_change_passphrase.py | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/account_ebics/README.rst b/account_ebics/README.rst index dd9e9d7..edc03e8 100644 --- a/account_ebics/README.rst +++ b/account_ebics/README.rst @@ -213,6 +213,6 @@ You can also find this information in the doc folder of this module (file EBICS_ Known Issues / Roadmap ====================== -- add support to import externally generated keys & certificates (currently only 3SKey signature certificate) +- add support to import externally generated keys & certificates (currently only 3SKey signature certificate). - For Odoo 16.0 the interaction with the OCA payment order and bank statement import modules (e.g. french CFONB) is not yet available. diff --git a/account_ebics/wizards/ebics_change_passphrase.py b/account_ebics/wizards/ebics_change_passphrase.py index 4c4ed9b..bdca195 100644 --- a/account_ebics/wizards/ebics_change_passphrase.py +++ b/account_ebics/wizards/ebics_change_passphrase.py @@ -31,16 +31,24 @@ class EbicsChangePassphrase(models.TransientModel): def change_passphrase(self): self.ensure_one() - if self.old_pass != self.ebics_userid_id.ebics_passphrase: + if ( + self.ebics_userid_id.ebics_passphrase_store + and self.old_pass != self.ebics_userid_id.ebics_passphrase + ): raise UserError(_("Incorrect old passphrase.")) if self.new_pass != self.new_pass_check: raise UserError(_("New passphrase verification error.")) if self.new_pass == self.ebics_userid_id.ebics_passphrase: raise UserError(_("New passphrase equal to old passphrase.")) try: + passphrase = ( + self.ebics_userid_id.ebics_passphrase_store + and self.ebics_userid_id.ebics_passphrase + or self.old_pass + ) keyring = EbicsKeyRing( keys=self.ebics_userid_id.ebics_keys_fn, - passphrase=self.ebics_userid_id.ebics_passphrase, + passphrase=passphrase, ) keyring.change_passphrase(self.new_pass) except ValueError as err: