RADIUSdesk WiFi Hotspot Manager and GUI for FreeRADIUS
MESHdesk Streamlined Mesh Controller

Changing the password

change_permanent_password.php
<?php
 
print("RADIUSdesk API to Change the password for a Permanent user");
/*
 
    * = required
    *-* = option or alternative
 
    * password	dvdwalt
    * token	52190fff-a800-48eb-b1f2-478bc0a80167 //The token of a user who have this righs
 
    *-* user_id	187
    *-* username dvdwalt
*/
 
$password   = 'dvdwalt';
$user_id	= 187; 
$username   = 'dvdwalt';
$token	    = '52190fff-a800-48eb-b1f2-478bc0a80167';
$url        = 'http://127.0.0.1/cake2/rd_cake/permanent_users/change_password.json';
 
// The data to send to the API
$postData = array(
    'password'  => $password,
    'user_id'     => $user_id,
    //'username'  => $username,
    'token'     => $token
);
 
// Setup cURL
$ch = curl_init($url);
curl_setopt_array($ch, array(
 
    CURLOPT_POST            => TRUE,
    CURLOPT_RETURNTRANSFER  => TRUE,
    CURLOPT_HTTPHEADER => array(
        'Content-Type: application/json'
    ),
    CURLOPT_POSTFIELDS => json_encode($postData)
));
 
// Send the request
$response = curl_exec($ch);
 
// Check for errors
if($response === FALSE){
    die(curl_error($ch));
}
 
// Decode the response
$responseData = json_decode($response, TRUE);
print_r($responseData);
 
?>