mirror of
https://github.com/brain-tec/account_ebics.git
synced 2024-11-23 20:52:04 +00:00
[IMP]account_ebics UI improvements
This commit is contained in:
parent
604ce31ae1
commit
f2a9af0deb
@ -284,20 +284,27 @@ class EbicsUserID(models.Model):
|
|||||||
if self.signature_class == "T":
|
if self.signature_class == "T":
|
||||||
self.swift_3skey = False
|
self.swift_3skey = False
|
||||||
|
|
||||||
@api.onchange("ebics_passphrase_store")
|
@api.onchange("ebics_passphrase_store", "ebics_passphrase")
|
||||||
def _onchange_ebics_passphrase_store(self):
|
def _onchange_ebics_passphrase_store(self):
|
||||||
if self.ebics_passphrase_store:
|
if self.ebics_passphrase_store:
|
||||||
|
if self.ebics_passphrase:
|
||||||
# check passphrase before db store
|
# check passphrase before db store
|
||||||
keyring_params = {
|
keyring_params = {
|
||||||
"keys": self.ebics_keys_fn,
|
"keys": self.ebics_keys_fn,
|
||||||
"passphrase": self.ebics_passphrase,
|
"passphrase": self.ebics_passphrase,
|
||||||
}
|
}
|
||||||
|
keyring = EbicsKeyRing(**keyring_params)
|
||||||
try:
|
try:
|
||||||
# TODO: implement check passphrase logic
|
# fintech <= 7.4.3 does not have a call to check if a
|
||||||
keyring = EbicsKeyRing(**keyring_params) # noqa: F841
|
# passphrase matches with the value stored in the keyfile.
|
||||||
except Exception as err:
|
# We get around this limitation as follows:
|
||||||
raise UserError(str(err)) from err
|
# Get user keys to check for valid passphrases
|
||||||
elif not self.ebics_passphrase_store and self.state != "draft":
|
# It will raise a ValueError on invalid passphrases
|
||||||
|
keyring["#USER"]
|
||||||
|
except ValueError as err: # noqa: F841
|
||||||
|
raise UserError(_("Passphrase mismatch.")) # noqa: B904
|
||||||
|
else:
|
||||||
|
if self.state != "draft":
|
||||||
self.ebics_passphrase = False
|
self.ebics_passphrase = False
|
||||||
|
|
||||||
@api.onchange("swift_3skey")
|
@api.onchange("swift_3skey")
|
||||||
|
Loading…
Reference in New Issue
Block a user