UniSierra Eats does not use JWTs or server-side cookies. Instead, the server returns a plain user object on successful login, and the frontend stores it as JSON in the browser’sDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/JuseAR27/Unisierra-eats/llms.txt
Use this file to discover all available pages before exploring further.
localStorage under the key unisierra_sesion. Every page checks this key on load to decide what UI to show — authenticated nav, profile links, admin controls, or the public login/register buttons.
Session Object Structure
After a successful login the object stored inlocalStorage has the following shape:
| Field | Type | Description |
|---|---|---|
id | Integer | Primary key of the user in the Usuarios table |
nombre | String | Full display name |
correo | String | Institutional email address |
rol_id | Integer | 1 = Administrador, 2 = Estudiante |
Registration
Endpoint:POST /api/registro
Request body:
200 OK):
{ "error": "Error al registrar: Es posible que el correo ya esté en uso." }.
Example fetch call (from app.js):
Login
Endpoint:POST /api/login
Request body:
200 OK):
401 Unauthorized):
Login Examples
- Student Login
- Admin Login
Students have
rol_id === 2. After login the session is saved and the page reloads to reveal the authenticated nav bar.Role-Based Redirect
Oncedata.usuario is received, app.js inspects rol_id to decide where to send the user:
rol_id | Role | Redirect destination |
|---|---|---|
1 | Administrador | admin/panel_admin.html |
2 | Estudiante | Current page reload (stays on public site) |
Logout
Logout is entirely client-side: the session key is removed fromlocalStorage and the user is sent back to the landing page.
Admin Registration
A separate endpoint registers a user withrol_id = 1 (Administrador). It accepts the same fields as the student registration endpoint.
Endpoint: POST /api/admin/registro
Request body:
200 OK):
The admin registration response uses the key
message (English), while most other endpoints use mensaje (Spanish). This is an intentional difference in the source code.@unisierra.edu.mx domain restriction applies. If the email already exists the server returns HTTP 400.
Passwords are stored in plaintext in the SQLite database. UniSierra Eats is a demo application and is not intended for production use with real credentials. Do not reuse passwords from other services.