mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-01-28 08:03:36 +00:00
users: Update Change Password menu for non-admin users
Don't show Create User menu item to non-admin users. Previously this was fixed for the Edit User page, and this fixes it also for the Change Password page. Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
parent
15c7202a6b
commit
4dc83f135a
@ -201,6 +201,13 @@ class UserChangePassword(ContextMixin, SuccessMessageMixin, FormView):
|
||||
update_session_auth_hash(self.request, form.user)
|
||||
return super(UserChangePassword, self).form_valid(form)
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
"""Remove subsubmenu for non-admin users."""
|
||||
context = super(UserChangePassword, self).get_context_data(**kwargs)
|
||||
if not is_user_admin(self.request):
|
||||
del context['subsubmenu']
|
||||
return context
|
||||
|
||||
|
||||
class FirstBootView(django.views.generic.CreateView):
|
||||
"""Create user account and log the user in."""
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user