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