From 466cb94e977e6c62263125934646fde5a582bc2f 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.class.php | 10 ++++++++--
 lib/classes/auth_plugins/StudipAuthLdap.class.php     |  6 +++---
 2 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/lib/classes/auth_plugins/StudipAuthAbstract.class.php b/lib/classes/auth_plugins/StudipAuthAbstract.class.php
index 36c75df646f..8fdd94cd74f 100644
--- a/lib/classes/auth_plugins/StudipAuthAbstract.class.php
+++ b/lib/classes/auth_plugins/StudipAuthAbstract.class.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.class.php b/lib/classes/auth_plugins/StudipAuthLdap.class.php
index 7cb86860028..a58a03b1716 100644
--- a/lib/classes/auth_plugins/StudipAuthLdap.class.php
+++ b/lib/classes/auth_plugins/StudipAuthLdap.class.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