From 94c536cd4788a4044bc96cb827f08ca2694c5d71 Mon Sep 17 00:00:00 2001
From: phpipam <miha.petkovsek@telemach.si>
Date: Thu, 21 Dec 2023 09:36:07 +0100
Subject: [PATCH] Radius fixes

---
 functions/classes/class.User.php | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/functions/classes/class.User.php b/functions/classes/class.User.php
index e2d023cc..92924e17 100644
--- a/functions/classes/class.User.php
+++ b/functions/classes/class.User.php
@@ -1,5 +1,11 @@
 <?php
 
+//
+// needed for radius auth
+//
+use Dapphp\Radius\Radius;
+
+
 /**
 *
 *  User class to work with current user, authentication etc
@@ -1253,8 +1259,13 @@ class User extends Common_functions {
                ->setNasIpAddress(gethostbyname(gethostname()))
                ->setAttribute(32, 'login');
 
+
+        // debug?
+        if($this->debugging)
+        $client->setDebug(true);
+
         // fake type for testing
-        $params->authType = "pap";
+        $params->authType = "chap";
 
         // pap
         if(!isset($params->authType) || @$params->authType=="pap") {
@@ -1279,10 +1290,6 @@ class User extends Common_functions {
             $this->Result->show("danger", _("Invalid radius authentication method"), true);
         }
 
-        # debug?
-        if($this->debugging)
-        $client->setDebug(true);
-
         # authenticate user
         if($authenticated === true) {
             # check login restrictions for authenticated user
-- 
GitLab