From bceab271d901378182907a3e69270a0771c7f397 Mon Sep 17 00:00:00 2001
From: Jan-Hendrik Willms <tleilax+studip@gmail.com>
Date: Mon, 8 Jul 2024 10:28:43 +0000
Subject: [PATCH] use correct error property for auth plugins, fixes #4374

Closes #4374

Merge request studip/studip!3179
---
 lib/classes/auth_plugins/StudipAuthAbstract.php | 10 ++++++++--
 lib/classes/auth_plugins/StudipAuthLdap.php     |  6 +++---
 2 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/lib/classes/auth_plugins/StudipAuthAbstract.php b/lib/classes/auth_plugins/StudipAuthAbstract.php
index 19d5afa73ad..e701c3310b6 100644
--- a/lib/classes/auth_plugins/StudipAuthAbstract.php
+++ b/lib/classes/auth_plugins/StudipAuthAbstract.php
@@ -535,7 +535,10 @@ class StudipAuthAbstract
      */
     function isUsedUsername($username)
     {
-        $this->error_msg = sprintf(_('Methode %s nicht implementiert!'), get_class($this) . '::isUsedUsername()');
+        $this->error_msg = sprintf(
+            _('Methode %s nicht implementiert!'),
+            __METHOD__
+        );
         return false;
     }
 
@@ -551,7 +554,10 @@ class StudipAuthAbstract
      */
     function isAuthenticated($username, $password)
     {
-        $this->error = sprintf(_('Methode %s nicht implementiert!'), get_class($this) . '::isAuthenticated()');
+        $this->error_msg = sprintf(
+            _('Methode %s nicht implementiert!'),
+            __METHOD__
+        );
         return false;
     }
 
diff --git a/lib/classes/auth_plugins/StudipAuthLdap.php b/lib/classes/auth_plugins/StudipAuthLdap.php
index 6bbd3fd43ce..e0430ee745a 100644
--- a/lib/classes/auth_plugins/StudipAuthLdap.php
+++ b/lib/classes/auth_plugins/StudipAuthLdap.php
@@ -188,18 +188,18 @@ class StudipAuthLdap extends StudipAuthAbstract
     function isUsedUsername($username)
     {
         if (!$this->anonymous_bind) {
-            $this->error = _('Kann den Benutzernamen nicht überprüfen, anonymous_bind ist ausgeschaltet!');
+            $this->error_msg = _('Kann den Benutzernamen nicht überprüfen, anonymous_bind ist ausgeschaltet!');
             return false;
         }
         if (!$this->doLdapConnect()) {
             return false;
         }
         if (!($r = @ldap_bind($this->conn))) {
-            $this->error = _('Anonymer Bind fehlgeschlagen.') . $this->getLdapError();
+            $this->error_msg = _('Anonymer Bind fehlgeschlagen.') . $this->getLdapError();
             return false;
         }
         if (!($result = @ldap_search($this->conn, $this->base_dn, $this->getLdapFilter($username), ['dn']))) {
-            $this->error = _('Anonymes Durchsuchen des LDAP Baumes fehlgeschlagen.') . $this->getLdapError();
+            $this->error_msg = _('Anonymes Durchsuchen des LDAP Baumes fehlgeschlagen.') . $this->getLdapError();
             return false;
         }
         if (!ldap_count_entries($this->conn, $result)) {
-- 
GitLab