backups: Require passphrase for encryption in add repository form

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
This commit is contained in:
Sunil Mohan Adapa authored and Joseph Nuthalapati committed 2019-07-03 12:44:09 +05:30
1 parent 2a2cc41f1d
commit f2ea0b9065
1 file changed
+4
+4
View File
@@ -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):