From 027c1441a268987c8377b9cfe5869c49cff48e66 Mon Sep 17 00:00:00 2001
From: Jan-Hendrik Willms <tleilax+studip@gmail.com>
Date: Tue, 18 Apr 2023 10:43:03 +0000
Subject: [PATCH] hide password change navigation when password is not
 changable, fixes #2552

Closes #2552

Merge request studip/studip!1725
---
 lib/navigation/ProfileNavigation.php | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/lib/navigation/ProfileNavigation.php b/lib/navigation/ProfileNavigation.php
index 65faca9ae6b..ffff06cbeb4 100644
--- a/lib/navigation/ProfileNavigation.php
+++ b/lib/navigation/ProfileNavigation.php
@@ -62,8 +62,16 @@ class ProfileNavigation extends Navigation
             // profile data
             $navigation = new Navigation(_('Persönliche Angaben'));
             $navigation->addSubNavigation('profile', new Navigation(_('Grunddaten'), 'dispatch.php/settings/account'));
-            if (($perm->get_profile_perm($current_user->user_id) == 'user'
-                || ($perm->have_perm('root') && Config::get()->ALLOW_ADMIN_USERACCESS))) {
+            if (
+                !StudipAuthAbstract::CheckField('auth_user_md5.password', $current_user->auth_plugin)
+                && (
+                    $perm->get_profile_perm($current_user->user_id) === 'user'
+                    || (
+                        $perm->have_perm('root')
+                        && Config::get()->ALLOW_ADMIN_USERACCESS
+                    )
+                )
+            ) {
                 $navigation->addSubNavigation('password', new Navigation(
                     _('Passwort ändern'),
                     'dispatch.php/settings/password'
-- 
GitLab