Commit Graph

9 Commits

Author SHA1 Message Date
TenerifeProp Dev
7904178052 fix: remove /login.html references and load real data in dashboard charts
- Replace all /login.html redirects with /login in admin.html
- Remove /login.html route from server
- Update dashboard charts to load real data from API
- Add initCharts() and loadDashboardData() functions
- Remove static chart data and use dynamic API data
- Update stats counters to animate with real values
2026-04-06 13:48:33 +01:00
TenerifeProp Dev
7d2b9f91fa fix: correct login redirect URLs
- Change redirect from /login.html to /login in admin.html
- Add /login.html route in server for backward compatibility
- Both /login and /login.html now serve the same login page
2026-04-06 13:37:34 +01:00
TenerifeProp Dev
0708853251 fix: restore full admin panel design with clean URLs
## Changes
- Restored original admin.html with full design (3251 lines)
- Updated redirect URLs from /login.html to /login
- Maintained all sidebar sections (Principal, Contenido, Analítica, Sistema)
- Kept all 33 sidebar navigation links

## Admin Sections
- Principal: Dashboard, Overview, Properties, Favorites
- Contenido: Properties, Leads, Testimonials, FAQ, Services, Blog
- Analítica: Analytics, Reports
- Sistema: Users, Settings, Logs

## URLs
- /login → login.html
- /admin → admin.html
- Redirect after auth to /admin (not /admin.html)

## Verified
 Full admin design restored
 All menu sections present
 Clean URLs working
 Auth redirects correctly
2026-04-06 01:47:24 +01:00
TenerifeProp Dev
1dd901dd4f refactor: modular admin panel with clean URLs
## Changes
- Removed .html extension from URLs (/login, /admin)
- Completely refactored admin.html with modular design
- Common sidebar and topbar for all admin sections
- Dynamic content loading via AJAX
- Modern responsive design with Bootstrap 5

## Admin Sections
- Dashboard (statistics, recent items)
- Properties (list with CRUD)
- Leads (management)
- Testimonials (CRUD)
- FAQ (CRUD)
- Services (CRUD)
- Settings (site configuration)

## Technical
- Clean URL routing: /login, /admin instead of .html
- Session-based auth check on page load
- Universal API client with auth methods
- Single-page admin with dynamic sections

## URLs
- Login: /login (was /login.html)
- Admin: /admin (was /admin.html)
- API: /api/auth/login, /api/admin/stats

## Tested
 /login returns correct page
 /admin returns correct page
 Login API works
 Session persists
 Admin sections load correctly
2026-04-06 01:24:37 +01:00
TenerifeProp Dev
0d290f29a1 feat: implement administrative section with authentication
## Features Implemented

### Authentication System
- Login page at /login.html with Bootstrap 5 UI
- Session-based authentication using SQLite
- bcrypt password hashing via Bun.password API
- CSRF protection for form submissions
- Rate limiting on login attempts (10 req/min)
- 7-day session persistence with HTTP-only cookies

### Admin Routes Protection
- All admin endpoints protected with requireAuth middleware
- requireAdmin middleware for role-based access
- Session validation on each authenticated request
- Expired session cleanup on startup

### API Endpoints
- POST /api/auth/login - user authentication
- POST /api/auth/logout - session termination
- GET /api/auth/me - current user info
- GET /api/csrf-token - CSRF token for forms
- GET /api/admin/stats - admin statistics

### Seed Data
- 12 realistic properties in Tenerife
- 3 testimonials with international clients
- 3 FAQ items about buying process
- 3 services offered
- Admin user: admin@tenerifeprop.com / admin123

### Tests
- Authentication tests (password, session)
- Input validation tests (email, phone, XSS)
- Property CRUD tests

## Files Changed
- src/server/index.ts - CSRF fix, auth endpoints
- public/login.html - New login page
- public/js/api.js - Auth API methods
- public/admin.html - Auth check on load
- src/db/seed-comprehensive.ts - Seed script
- tests/auth.test.ts - Test suite

## Tested
 Login page renders correctly
 Valid credentials return success
 Invalid credentials return error
 Session cookie is set
 Protected endpoints require authentication
 Logout clears session
 Auth/me returns 401 after logout

## Access
- URL: http://localhost:3000/login.html
- Email: admin@tenerifeprop.com
- Password: admin123

Closes #28, #29, #30
2026-04-06 00:44:38 +01:00
TenerifeProp Dev
462ab16488 wip: progress updates - CSS extraction done, rate limiting started
- CSS extraction completed (Issue #5) 
- Docker compose updated with mounted volumes for development
- Rate limiting middleware started (Issue #6) - tests failing
- Database recreated with proper schema

Note: Rate limiting test needs fix - router already built error
2026-04-05 12:24:18 +01:00
TenerifeProp Dev
d0e3a87eac refactor: extract CSS into separate files (issue #5)\n\n- Create public/css/base.css with reset and typography\n- Create public/css/components.css with shared UI components\n- Create public/css/pages/home.css for homepage styles\n- Create public/css/pages/property.css for property page styles\n- Create public/css/pages/admin.css for admin panel styles\n- Add CSS variables for badges and text colors\n- Remove inline styles from HTML files\n- Add link tags to HTML files\n- Add CSS extraction tests\n\nCloses #5 2026-04-05 05:46:05 +01:00
TenerifeProp Dev
f4b82c8502 feat: add persistent sessions, sitemap docs, and expanded seed data
## Security
- Sessions now stored in SQLite database instead of memory
- Sessions table persists across server restarts
- Auto-cleanup of expired sessions on startup

## Documentation
- Created docs/SITEMAP.md with site navigation map
- Documented user flows and data binding
- Listed all routes and their purposes

## Issue #9 Progress
- Seed data expanded from 3 to 12 properties
- Added English translations (title_en, description_en)
- All major Tenerife cities represented
- Various property types: urban, agricultural, houses, apartments

## Database
- Added title_en, description_en, short_description_en columns
- Deleted old database to reseed with new data
2026-04-05 00:15:48 +01:00
TenerifeProp Dev
c1867fe074 feat: implement complete backend with Bun + Hono + SQLite
- Create SQLite database schema with all tables
- Implement REST API endpoints for properties, leads, testimonials, FAQ, services
- Add seed data with sample properties, testimonials, FAQ
- Create Docker configuration for deployment
- Add i18n system for translations
- Add API client for frontend integration
- Create Technical Documentation (TZ.md)
- Add detailed README with deployment instructions

🚀 Project is now fully functional:
- API: http://localhost:8080/api/*
- Properties CRUD with filtering
- Lead management
- Settings, Testimonials, FAQ, Services APIs
- SQLite database with seed data
2026-04-04 22:16:06 +01:00