Captive portal authentication must be done by submitting a form (we can't use ajax unfortunately).
A form like the following one:
<form name="userauth" method="post" class="hidden"
id="captive-portal-form"
action="http://cp.domain.com/index.php?etc">
<input type="hidden" name="auth_user">
<input type="hidden" name="auth_pass">
<input type="hidden" name="zone" value="zone_name">
<input type="hidden" name="redirurl" value="https://wifi-login-app/status">
<input type="hidden" name="accept" value="accept">
<input type="submit" value="Login">
</form>
We should have a way to define fields dynamically in the configuration, eg:
captive_portal_form:
name: user_auth
method: post
action: http://cp.domain.com/index.php?etc
fields:
username: auth_user
password: auth_pass
additional_fields:
- zone: zone_name
- redirurl: https://wifi-login-app/status
- accept: accept
The username and password fields have to be automatically filled after login & reauthentication and then the form should be submitted automatically.
The user should not see the status page at all, it will be redirected to it by the captive portal.
EDIT: there's an alternative, using an iframe, I just tested this and it works, the captive portal form is included with an iframe (hidden with css) and submitted there, we can use the load
event of the iframe to find out the result from the captive portal and only then show the status page or if there was any error, like when the maximum daily bandwidth has been reached, the error will be shown to the user and the operation canceled.
This needs test + docs.