diff --git a/plinth/modules/first_boot/forms.py b/plinth/modules/first_boot/forms.py index a85265dc3..bb26a401a 100644 --- a/plinth/modules/first_boot/forms.py +++ b/plinth/modules/first_boot/forms.py @@ -48,8 +48,11 @@ than 63 characters in length.'), 'password': forms.PasswordInput, } help_texts = { - 'username': _('Choose a username and password to access this web\ - interface. The password can be changed and other users can be added later.'), + 'username': + _('Choose a username and password to access this web interface. ' + 'The password can be changed and other users can be added ' + 'later. A POSIX system user with administrative privileges ' + '(sudo) is also created.'), } def save(self, commit=True): diff --git a/plinth/modules/users/templates/users_change_password.html b/plinth/modules/users/templates/users_change_password.html index 15a148c04..17737170e 100644 --- a/plinth/modules/users/templates/users_change_password.html +++ b/plinth/modules/users/templates/users_change_password.html @@ -31,6 +31,12 @@ {{ form|bootstrap }} + {% if is_posix_user %} +

This user is also a POSIX system user and password for POSIX system + user will also be updated. +

+ {% endif %} + diff --git a/plinth/modules/users/templates/users_delete.html b/plinth/modules/users/templates/users_delete.html index fa2b2ffc2..8f4d95899 100644 --- a/plinth/modules/users/templates/users_delete.html +++ b/plinth/modules/users/templates/users_delete.html @@ -24,6 +24,12 @@

Delete User {{ object.username }}

+ {% if is_posix_user %} +

This user is also a POSIX system user. POSIX system user will also be + deleted. +

+ {% endif %} +

Delete user permanently?

diff --git a/plinth/modules/users/templates/users_update.html b/plinth/modules/users/templates/users_update.html index cbd5bde40..bf04b4e69 100644 --- a/plinth/modules/users/templates/users_update.html +++ b/plinth/modules/users/templates/users_update.html @@ -46,10 +46,11 @@ {{ form|bootstrap }} - {% if is_posix_user %} -

This user is also a POSIX user and (if active) can log in to the - system through SSH.

- {% endif %} + {% if is_posix_user %} +

This user is also a POSIX system user and, if active, can log in to + the system through SSH. +

+ {% endif %} diff --git a/plinth/modules/users/views.py b/plinth/modules/users/views.py index e070b1e71..16f9be4a5 100644 --- a/plinth/modules/users/views.py +++ b/plinth/modules/users/views.py @@ -94,6 +94,13 @@ class UserDelete(ContextMixin, DeleteView): success_url = reverse_lazy('users:index') title = _('Delete User') + def get_context_data(self, **kwargs): + """Return the data to be used for rendering templates.""" + context = super(UserDelete, self).get_context_data(**kwargs) + output = actions.run('check-user-exists', [self.kwargs['slug']]) + context['is_posix_user'] = 'User exists' in output + return context + def delete(self, *args, **kwargs): """Set the success message of deleting the user. @@ -119,6 +126,13 @@ class UserChangePassword(ContextMixin, SuccessMessageMixin, FormView): kwargs['user'] = User.objects.get(username=self.kwargs['slug']) return kwargs + def get_context_data(self, **kwargs): + """Return the data to be used for rendering templates.""" + context = super(UserChangePassword, self).get_context_data(**kwargs) + output = actions.run('check-user-exists', [self.kwargs['slug']]) + context['is_posix_user'] = 'User exists' in output + return context + def get_success_url(self): return reverse('users:edit', kwargs={'slug': self.kwargs['slug']})