Merge pull request #91 from Noviat/16-fix-change-passphrase

[FIX][16.0]fix change passphrase for non-stored paspphrase
This commit is contained in:
Luc De Meyer 2023-05-28 10:48:59 +02:00 committed by GitHub
commit 17b6a4aedc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 3 deletions

View File

@ -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.

View File

@ -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: