Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/KevinCruz-cell/Redes-de-comunicaciones-/llms.txt

Use this file to discover all available pages before exploring further.

The app authenticates you directly against your OpenWrt router’s LuCI interface over HTTP. Before checking your credentials it first verifies the router is reachable, so any network problem is surfaced immediately. On success, the app stores a session cookie and the LuCI sysauth token so subsequent requests to protected routes work without re-authentication.

Session lifecycle

All routes except /login check for session('router_logged_in'). If that session key is absent or falsy, the request is redirected to /login. After a successful login the session holds:
KeyValue
router_logged_intrue
router_ipRouter IP from ROUTER_IP env var (default 192.168.10.1)
router_userUsername that was used to log in
router_sysauthLuCI sysauth cookie value
router_locationRedirect Location header returned by LuCI

POST /login

Authenticates the user against the router’s LuCI interface and creates a server-side session.
The app first sends a GET request to http://{ROUTER_IP}/cgi-bin/luci/ to confirm the router is online. If this probe fails, login is rejected with an error before credentials are even checked.

Request

Submit as an HTML form (application/x-www-form-urlencoded) or include the fields in a JSON request body.
usuario
string
required
Username to authenticate with on the OpenWrt router. Typically root.
password
string
required
Password for the router account.

Responses

Success — redirects to /dhcp with the session established. Router not reachable — redirects back with a validation error on the router key:
{
  "errors": {
    "router": ["No se detecto el router en 192.168.10.1. Revisa el cable Ethernet y tu red."]
  }
}
Wrong credentials — redirects back with a validation error on the password key:
{
  "errors": {
    "password": ["Usuario o contrasena incorrectos."]
  }
}

How authentication works internally

The app forwards credentials to the LuCI endpoint using the form fields luci_username and luci_password. LuCI responds with HTTP 302 and sets a sysauth cookie if the credentials are correct. The app extracts that cookie and stores it in the Laravel session for use in subsequent SSH-authenticated requests.
# Example login request
curl -X POST http://your-app.local/login \
  -d "usuario=root" \
  -d "password=your-router-password"

POST /logout

Clears all router session data and redirects to /login. No request body is required. The following session keys are removed:
  • router_logged_in
  • router_ip
  • router_user
  • router_sysauth
  • router_location
curl -X POST http://your-app.local/logout \
  -H "X-CSRF-TOKEN: your-csrf-token"
After logout, all subsequent requests to protected routes redirect to /login.

Protected route guard

Every protected view route uses an inline session check:
if (!session('router_logged_in')) {
    return redirect('/login');
}
API endpoints under /api/router/*, /api/router3/*, /sistema/*, and /administracion/* rely on the same session being present because the SSH connection is established server-side using the credentials stored at login time.
If you receive unexpected redirects to /login, your session may have expired or the server may have been restarted. Log in again to re-establish the session.

Build docs developers (and LLMs) love