users: Add posix user messages to other user management forms

- Slightly modify the message in user update form
This commit is contained in:
Sunil Mohan Adapa committed 2015-01-25 01:45:43 +05:30
1 parent baa9205852
commit d27cd02193
5 files changed
+36 -6

No files matched your search

@@ -31,6 +31,12 @@
{{ 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"/>
</form>
@@ -24,6 +24,12 @@
<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>
<form class="form" method="post">
@@ -46,10 +46,11 @@
{{ form|bootstrap }}
{% if is_posix_user %}
<p>This user is also a POSIX user and (if active) can log in to the
system through SSH.</p>
{% endif %}
{% if is_posix_user %}
<p>This user is also a POSIX system user and, if active, can log in to
the system through SSH.
</p>
{% endif %}
<input type="submit" class="btn btn-primary" value="Save Changes"/>
+14
View File
@@ -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']})