From f2ea0b9065c49a00ec01a2eab5571dc89edcb756 Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Mon, 24 Jun 2019 16:49:32 -0700 Subject: [PATCH] backups: Require passphrase for encryption in add repository form Signed-off-by: Sunil Mohan Adapa Reviewed-by: Joseph Nuthalapati --- plinth/modules/backups/forms.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/plinth/modules/backups/forms.py b/plinth/modules/backups/forms.py index 2b101eed6..a070046fd 100644 --- a/plinth/modules/backups/forms.py +++ b/plinth/modules/backups/forms.py @@ -161,6 +161,10 @@ class AddRepositoryForm(forms.Form): raise forms.ValidationError( _('The entered encryption passphrases do not match')) + if self.cleaned_data.get('encryption') != 'none' and not passphrase: + raise forms.ValidationError( + _('Passphrase is needed for encryption.')) + return self.cleaned_data def clean_repository(self):