lirantal / daloradius

daloRADIUS is an advanced RADIUS web management application for managing hotspots and general-purpose ISP deployments. It features user management, graphical reporting, accounting, a billing engine, and integrates with OpenStreetMap for geolocation. The system is based on FreeRADIUS with which it shares access to the backend database.
http://www.daloradius.com
GNU General Public License v2.0
653 stars 335 forks source link

Expiration Date Format #538

Closed Mezosoft5 closed 2 months ago

Mezosoft5 commented 3 months ago

Hi, There is a problem that I cannot solve When I choose the attribute (Expiration) and after choosing the desired date The date is inserted into the databases in this format (2024-07-10) When I log in with this number, a login error occurs This is the freeRADIUS Log Auth: (1) Invalid user (sql: Error parsing value: failed to parse time string "2024-07-10"): [123456] (from client hosts port 2 cli XX -XX-XX-XX-XX-XX) I think the date format should be included in databases like this (10 Jul 2024) How can this problem be solved? Here are some pictures from inside the Edit User page and from inside the (radcheck) table in the databases

01

02

filippolauria commented 3 months ago

@Mezosoft5 there is a simple work around for this issue:

Mezosoft5 commented 3 months ago

@filippolauria Thank you for replying I already know how to edit the user and fix the wrong expiration value But the problem is in creating (Batch Users) If I create a batch with (100 users) How do I fix the expiration value for a batch that was created? I think the problem should be solved internally from daloRADIUS setup files

filippolauria commented 3 months ago

Ok. In the meanwhile you can add your Expiration attribute to a Profile (aka Group).. image and then assign that Group while creating your batch image

Mezosoft5 commented 3 months ago

@filippolauria Thank you for clarifying this point I've tried this before I added (Expiration attribute) in (Profile) But I faced a new problem : A new value must be added to the date daily Until it expires on the specified date from the time of creation.

As for the second point It is a temporary solution that can be used until a radical solution to this problem is found By modifying the attributes file located in var/www/daloradius/app/operators/library/ajax/attributes.php

1

On line 61, if I change the type from (date) to (text) In this case, can add the date manually instead of choosing it from the custom calendar that appears for selection. To get the correct date value (if you don't know) You can click on the Description icon and then copy the value in Description and modify it in the input field for the date

2

I ask those working on updating daloRADIUS to attention to this problem and solve it in new versions Because it was already working in previous versions.

filippolauria commented 3 months ago

Ok. A fix has been provided. https://github.com/lirantal/daloradius/blob/3d6149de5f26eaefe379b639ac44a902da3ea22f/app/operators/library/ajax/attributes.php#L86-L102

Mezosoft5 commented 2 months ago

@filippolauria Thank you for this solution I have improved the date format and added a simple modification To increase the time for the expiration date Because logically, if (Batch Users) or a (New User) is created, the expiration will not be determined at the time of creation So, I created ($futureDate) through which I add the time I want to increase according to what I want. Whether it is 1 day, 1 week, or 1 month This is the modified code


function drawHelperDate($num) { // Calculate the date 1 months ahead $futureDate = strtotime("+1 months");

// Format the date
$formattedDate = date("j M Y", $futureDate);

// Output the formatted date
printf(<<<EOF

objValues.setAttribute('type', 'text'); objValues.value = "%s";

EOF, $formattedDate); }


These are the values ​​that can be added depending on the choice To increase the time to 1 week instead of 1 month in this case it is replaced (+1 months) to (+1 weeks) To increase the time to 1 day instead of 1 week in this case it is replaced (+1 weeks) to (+1 days) Numbers can be increased from 1 to any number according to choice

02