backups: Avoid some repeated text in form help text

Tests:

- The remote repository add form shows form elements are updated as expected.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
Sunil Mohan Adapa 2026-02-04 16:24:19 -08:00
parent 58ecf9d3e4
commit 305b1f01f5
No known key found for this signature in database
GPG Key ID: 43EA1CFF0AA7C5F2

View File

@ -253,31 +253,27 @@ class AddRemoteRepositoryForm(EncryptedBackupsMixin, forms.Form):
validators=[repository_validator])
ssh_auth_type = forms.ChoiceField(
label=_('SSH Authentication Type'),
help_text=_('How to authenticate to the remote SSH server.<br />'
'If Key-based Authentication is selected, then the '
"FreedomBox service's SSH client public key must be added"
" to the authorized keys list on the remote server.<br />"
'If Password-based Authentication is selected, then '
'FreedomBox will attempt to copy its SSH client public '
'key to the remote server.'), widget=forms.RadioSelect(),
help_text=_('Choose how to authenticate to the remote SSH server.'),
widget=forms.RadioSelect(),
choices=[('key_auth', _('Key-based Authentication')),
('password_auth', _('Password-based Authentication'))])
ssh_password = forms.CharField(
label=_('SSH server password'), widget=forms.PasswordInput(),
strip=True,
help_text=_('Required only for password-based authentication.'),
strip=True, help_text=_('Required for password-based authentication.'),
required=False)
field_order = ['repository', 'ssh_auth_type', 'ssh_password'
] + encryption_fields
def clean(self):
"""Perform additional checks on form data."""
super().clean()
ssh_password = self.cleaned_data.get('ssh_password')
if self.cleaned_data.get(
'ssh_auth_type') == 'password_auth' and not ssh_password:
raise forms.ValidationError(
_('SSH password is needed for password-based authentication.'))
return self.cleaned_data
def clean_repository(self):