From 05949d60949c330daf322ccf1fbaa0fd76f3c1dc Mon Sep 17 00:00:00 2001 From: Luc De Meyer Date: Sun, 21 Jun 2020 13:38:59 +0200 Subject: [PATCH] add passphrase constraint --- account_ebics/models/ebics_config.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/account_ebics/models/ebics_config.py b/account_ebics/models/ebics_config.py index db08b36..16b53cf 100644 --- a/account_ebics/models/ebics_config.py +++ b/account_ebics/models/ebics_config.py @@ -228,6 +228,13 @@ class EbicsConfig(models.Model): cfg.ebics_keys_found = ( cfg.ebics_keys and os.path.isfile(cfg.ebics_keys)) + @api.constrains('ebics_passphrase') + def _check_ebics_passphrase(self): + for cfg in self: + if not cfg.ebics_passphrase or len(cfg.ebics_passphrase) < 8: + raise UserError(_( + "The passphrase must be at least 8 characters long")) + @api.constrains('order_number') def _check_order_number(self): for cfg in self: