Authentication in VinylVibes is handled byDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/akibanks/tienda_musica_web/llms.txt
Use this file to discover all available pages before exploring further.
login.html and login.js. After a successful login, the backend returns a JWT token which is stored in localStorage and sent with every protected API request. The login page presents two views in a single screen — a Login tab and a Register tab — with a decorative animated vinyl record panel shown on wider viewports.
Login
The login form (#login-form) submits a username and password to POST /login. On success, the response payload is written to localStorage and the user is redirected to index.html.
Request body:
localStorage keys written on success:
| Key | Value |
|---|---|
vv_token | JWT string returned by the backend |
usuarioLogueado | User’s display name |
esAdmin | "true" or "false" |
esDemo | "true" or "false" |
data.error is displayed in red beneath the form. The submit button is disabled while the request is in flight and re-enabled regardless of outcome.
Registration
The registration form (#registro-form) submits a new username and password to POST /registro. The password must be at least 6 characters — this rule is enforced client-side before the request is made.
Request body:
data.error message is displayed in red. Common failure reasons include a username that is already taken.
Using the JWT
All protected requests across the app include the JWT viaauthHeaders(). This function is defined in both script.js and admin.js and reads the token from localStorage at call time.
headers option to fetch:
Signing Out
CallcerrarSesion() from anywhere in the catalog page to end the session. It removes the three session-related keys from localStorage and updates the navbar to the logged-out state.
Keys removed on sign-out:
vv_tokenusuarioLogueadoesAdmin
cerrarSesion() does not remove vv_carrito, so any items added before sign-out remain in the cart and will be visible if the user logs back in on the same device.Demo Account
VinylVibes ships with a pre-seeded demo account that grants read-only access to the admin panel:Username
admin_chocolatePassword
chocolate| Flag | Value |
|---|---|
esAdmin | false |
esDemo | true |