Error Message

When a failed login occurs from Captive Portal, the user will be redirected to the splash page again with 2 additional query parameters res and reason to indicate the error. The https request to the splash page could be like this:

https://yourwebsite.com/splash.html?actionurl=......&res=failed&reason=xxxx

These 2 parameters can be used for displaying error message on splash page. The usage is depicted in the following table:

Parameters
Description

res=failed&reason=reject

Invalid username or password.

res=failed&reason=timeout

No response from authentication server.

res=failed&reason=mtu

Abnormal network error.

res=failed&reason=other

Other errors.

Reference Code

The following JavaScript code illustrates how to display error message in splash page.

   <script>
      function check_error(){
        const params = new Proxy(new URLSearchParams(window.location.search), {
          get: (searchParams, prop) => searchParams.get(prop),
        });
        if (params.res === "failed") {
          switch(params.reason) {
            case "reject":
              alert("Invalid Username or Password.");
              break;
            case "timeout":
              alert("No response from authentication server.");
              break;
            case "mtu":
              alert("Abnormal network error.");
              break;
            case "other":
              alert("Other errors.");
              break;
            default:
              alert("Other errors. (no reason)");
          }
        }
      }
    </script>    
  </head>

  <body onload="check_error()" style="">

Last updated