coova / coova-chilli

CoovaChilli is an open-source software access controller for captive portal hotspots.
Other
512 stars 258 forks source link

It doesnt work ChilliController.js #580

Open Pavewleln opened 3 months ago

Pavewleln commented 3 months ago

I am trying to set up a ChilliController.js. I think i have connected coova-chilli. He redirects me, everything if fine. But, the request back from the site to the router does not go througn, here is the code:

document.getElementById("loginForm").addEventListener("submit", async (event) => {
    event.preventDefault();
    const urlParams = new URLSearchParams(window.location.search);
    const username = document.getElementById("username").value;
    const password = document.getElementById("password").value;
    chilliController.host = urlParams.get('uamip');
    chilliController.port = urlParams.get('uamport');
    chilliController.interval = 60;
    // chilliController.challenge = urlParams.get('challenge');
    // chilliController.session = urlParams.get('sessionid');
    // chilliController.redir = urlParams.get('userurl');

    chilliController.onError = handleErrors;
    chilliController.onUpdate = updateUI;

    setTimeout(() => {
        chilliController.logon(username, password);
    }, 1000);
});

function updateUI(cmd) {
    alert('You called the method' + cmd + '\n Your current state is =' + chilliController.clientState);
}

function handleErrors(code) {
    alert('The last contact with the Controller failed. Error code =' + code);
}

chilliController.refresh();

I am get this Request URL: http://192.168.182.1:3990/json/status?callback=chilliJSON.reply&0.33341848012877806 Request Method: GET Status Code: 302 Moved Temporarily Remote Address: 192.168.182.1:3990 Referrer Policy: strict-origin-when-cross-origin

alert: JSON request timed out (or reply is not valid)

What am i doing wrong? I can assure you that username and password are correct.

Coova-chilli settings:

config chilli
    option tundev 'tun0'
    option network ''
    option ipup /etc/chilli/up.sh
    option ipdown /etc/chilli/down.sh

    # Radius parameters
    option radiusserver1 192.168.1.167
    option radiusserver2 192.168.1.167 
    option radiussecret testing123

    # DHCP Parameters
    option dhcpif br-lan
    option uamserver http://192.168.1.167/login.html
    #option uamsecret testing123
    #option uamdomain 192.168.1.167