mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-05-27 10:44:33 +00:00
users: Add posix user messages to other user management forms
- Slightly modify the message in user update form
This commit is contained in:
parent
baa9205852
commit
d27cd02193
@ -48,8 +48,11 @@ than 63 characters in length.'),
|
|||||||
'password': forms.PasswordInput,
|
'password': forms.PasswordInput,
|
||||||
}
|
}
|
||||||
help_texts = {
|
help_texts = {
|
||||||
'username': _('Choose a username and password to access this web\
|
'username':
|
||||||
interface. The password can be changed and other users can be added later.'),
|
_('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):
|
def save(self, commit=True):
|
||||||
|
|||||||
@ -31,6 +31,12 @@
|
|||||||
|
|
||||||
{{ form|bootstrap }}
|
{{ form|bootstrap }}
|
||||||
|
|
||||||
|
{% if is_posix_user %}
|
||||||
|
<p>This user is also a POSIX system user and password for POSIX system
|
||||||
|
user will also be updated.
|
||||||
|
</p>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
<input type="submit" class="btn btn-primary" value="Save Password"/>
|
<input type="submit" class="btn btn-primary" value="Save Password"/>
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
@ -24,6 +24,12 @@
|
|||||||
|
|
||||||
<h3>Delete User <em>{{ object.username }}</em></h3>
|
<h3>Delete User <em>{{ object.username }}</em></h3>
|
||||||
|
|
||||||
|
{% if is_posix_user %}
|
||||||
|
<p>This user is also a POSIX system user. POSIX system user will also be
|
||||||
|
deleted.
|
||||||
|
</p>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
<p>Delete user permanently?</p>
|
<p>Delete user permanently?</p>
|
||||||
|
|
||||||
<form class="form" method="post">
|
<form class="form" method="post">
|
||||||
|
|||||||
@ -46,10 +46,11 @@
|
|||||||
|
|
||||||
{{ form|bootstrap }}
|
{{ form|bootstrap }}
|
||||||
|
|
||||||
{% if is_posix_user %}
|
{% if is_posix_user %}
|
||||||
<p>This user is also a POSIX user and (if active) can log in to the
|
<p>This user is also a POSIX system user and, if active, can log in to
|
||||||
system through SSH.</p>
|
the system through SSH.
|
||||||
{% endif %}
|
</p>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
<input type="submit" class="btn btn-primary" value="Save Changes"/>
|
<input type="submit" class="btn btn-primary" value="Save Changes"/>
|
||||||
|
|
||||||
|
|||||||
@ -94,6 +94,13 @@ class UserDelete(ContextMixin, DeleteView):
|
|||||||
success_url = reverse_lazy('users:index')
|
success_url = reverse_lazy('users:index')
|
||||||
title = _('Delete User')
|
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):
|
def delete(self, *args, **kwargs):
|
||||||
"""Set the success message of deleting the user.
|
"""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'])
|
kwargs['user'] = User.objects.get(username=self.kwargs['slug'])
|
||||||
return kwargs
|
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):
|
def get_success_url(self):
|
||||||
return reverse('users:edit', kwargs={'slug': self.kwargs['slug']})
|
return reverse('users:edit', kwargs={'slug': self.kwargs['slug']})
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user