mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-11-29 08:25:10 +00:00
users: Change LDAP user password.
This commit is contained in:
1 parent
f16ea84f1d
commit
27e19b4373
5 files changed
+57
No files matched your search
@@ -144,4 +144,13 @@ class UserChangePasswordForm(SetPasswordForm):
|
||||
self.request,
|
||||
_('Changing POSIX system user password failed.'))
|
||||
|
||||
try:
|
||||
actions.superuser_run(
|
||||
'change-ldap-user-password',
|
||||
[user.get_username(), self.cleaned_data['new_password1']])
|
||||
except ActionError:
|
||||
messages.error(
|
||||
self.request,
|
||||
_('Changing LDAP user password failed.'))
|
||||
|
||||
return user
|
||||
@@ -37,6 +37,12 @@
|
||||
</p>
|
||||
{% endif %}
|
||||
|
||||
{% if is_ldap_user %}
|
||||
<p>This user is also an LDAP user and password for LDAP user will also
|
||||
be updated.
|
||||
</p>
|
||||
{% endif %}
|
||||
|
||||
<input type="submit" class="btn btn-primary" value="Save Password"/>
|
||||
|
||||
</form>
|
||||
|
||||
@@ -30,6 +30,10 @@
|
||||
</p>
|
||||
{% endif %}
|
||||
|
||||
{% if is_ldap_user %}
|
||||
<p>This user is also an LDAP user. LDAP user will also be deleted.</p>
|
||||
{% endif %}
|
||||
|
||||
<p>Delete user permanently?</p>
|
||||
|
||||
<form class="form" method="post">
|
||||
|
||||
@@ -116,6 +116,8 @@ class UserDelete(ContextMixin, DeleteView):
|
||||
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
|
||||
output = actions.run('check-ldap-user-exists', [self.kwargs['slug']])
|
||||
context['is_ldap_user'] = 'User exists' in output
|
||||
return context
|
||||
|
||||
def delete(self, *args, **kwargs):
|
||||
@@ -163,6 +165,8 @@ class UserChangePassword(ContextMixin, SuccessMessageMixin, FormView):
|
||||
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
|
||||
output = actions.run('check-ldap-user-exists', [self.kwargs['slug']])
|
||||
context['is_ldap_user'] = 'User exists' in output
|
||||
return context
|
||||
|
||||
def get_success_url(self):
|
||||
|
||||
Reference in new issue
Block a user