Commit Graph
30 Commits
Author SHA1 Message Date
Jeppe Bundgaard 7d450e285e Remove outdated edge gateway object classes, add new agent implementation
Transitioned from obsolete gateway object classes (`edge_gateway_shell_action_jobs_o`, `edge_gateway_shell_events_o`, `edge_gateway_shell_sessions_o`, `edge_gateway_update_jobs_o`) to the new agent implementation (`edge-gateway-agent/agent.php`).
2026-04-21 14:13:17 +02:00
Jeppe Bundgaard ebf7e820d5 Add safety seal support to orders and related logic for wash certificates
- Introduced `safety_seal` column in the `orders` table.
- Updated order creation and completion logic to handle safety seal values.
- Enhanced order and booking classes to manage safety seal attachment and retrieval.
- Added tests to validate safety seal functionality in order processing.
2026-04-14 10:51:25 +02:00
Jeppe Bundgaard a83b850aba Remove edge_broker_client.php and related unit tests. Add new dependencies and configuration files for edge-agent, including build scripts and package-lock updates. 2026-04-13 09:42:35 +02:00
Jeppe Bundgaard da2cbee987 Disable sending welcome emails to info@truckwash.dk as requested by Christian. 2026-03-18 13:29:37 +01:00
Jeppe Bundgaard 5cb197898d Improve live DB clone speed 2026-03-12 13:26:22 +01:00
Jeppe Bundgaard fc9d7882ae Refactor user retrieval logic to improve existence check for customer numbers 2026-02-26 22:51:37 +01:00
Jeppe Bundgaard 5cc311ae32 Add Redis-based permission caching for users and subusers
- Introduced Redis-backed caching for user and subuser permission evaluations in the `route_t` trait, reducing database queries.
- Enhanced `Redis` class with methods for permission caching: `cache_permission`, `get_permission`, and `clear_permission`.
- Added test coverage for the new caching logic in `PermissionRedisCacheTest.php`.
- Implemented Redis caching for authentication sessions with `cache_auth_session`, `get_auth_session`, and `clear_auth_session`.
- Improved CORS handling for preflight requests in `index.php`.
2026-02-24 15:00:22 +01:00
Jeppe Bundgaard 9920f1dd27 Refactor token generation to use create_token_by_user_id in customer authentication flow 2026-02-24 11:57:44 +01:00
Jeppe Bundgaard b291e959e0 Add WebAuthn integration, reCAPTCHA support, and new tests
- Integrate WebAuthn library for passkey authentication workflows, including assertion verification and improved error handling.
- Add support for reCAPTCHA token validation across multiple endpoints for enhanced security.
- Extend OpenAPI schema to document new fields and restructured payloads.
- Add unit tests for WebAuthn flows, permission initialization, and route validation to ensure robustness and accuracy.
2026-02-24 09:27:51 +01:00
Jeppe Bundgaard 2e88ed7bbd Add binding for acme-io.json in Traefik config 2026-02-24 00:28:17 +01:00
Jeppe Bundgaard 356e59bd10 Improve dynamic URL generation and add localhost support for passkey challenges
- Refactor direct download URL generation to dynamically use `HTTP_HOST` and protocol.
- Add support for localhost `rpId` during WebAuthn passkey challenges.
- Extend test cases to validate `localhost` and `truckwash.io` scenarios.
- Update OpenAPI specifications to reflect new `rpId` logic and additional server configurations.
2026-02-23 23:37:15 +01:00
Jeppe Bundgaard 61db62212c Add WebAuthn passkey challenge and verification endpoints
- Introduced endpoints for WebAuthn-based authentication flow (`/auth/passkey/challenge` and `/auth/passkey/verify`).
- Added support for generating and verifying WebAuthn PublicKeyCredentialRequestOptions and challenge tokens.
- Extended routing logic to expose matched route templates for improved parameter handling.
- Updated OpenAPI specifications to document passkey challenge and verification workflows.
- Included unit tests for validating both existing and non-existing user scenarios during passkey challenges.
2026-02-23 23:03:28 +01:00
Jeppe Bundgaard 63c88a463d Refactor passkey and token processing for improved consistency and validation
- Update passkey data mapping to use associative arrays and handle JSON decoding for `transports`.
- Refactor token caching logic to validate database existence and clear stale entries.
- Improve 2FA handling by centralizing `token->type` and `user_id` processing for reuse.
2026-02-23 22:44:06 +01:00
Jeppe Bundgaard eb0f4ca38b Enhance 2FA handling and subuser session management
- Add `two_factor_enabled` property for subuser responses in routes and OpenAPI specs.
- Improve subuser session resolution by checking token `id` for validity.
- Adjust authentication flow to prevent operations on nonexistent users in 2FA logic.
- Update OpenAPI request/response schema to better represent token/session objects.
2026-02-23 21:44:11 +01:00
Jeppe Bundgaard ce889053a6 Improve subuser session handling and 2FA logic
- Add fallback logic to resolve subuser sessions via the tokens table when cache is missing or expired, with re-caching for future use.
- Refactor 2FA flow to prioritize subuser over user objects for better clarity and ensure compatibility with TOTP logic.
- Add safeguards to avoid operations on nonexistent users or subusers in 2FA and authentication flows.
2026-02-23 18:57:20 +01:00
Jeppe Bundgaard f6b526f4ef Add two-factor authentication support for users and subusers
- Extend `users_o` and `subusers_o` with `two_factor_enabled` and `two_factor_secret` properties.
- Implement methods for managing 2FA (`isTwoFactorEnabled`, `setTwoFactorSecret`, `verify_2fa_code`) in authentication logic.
- Add 2FA handling in login flows for both users and subusers, including token generation and validation.
- Introduce `totp` class for TOTP-based authentication, including QR code generation and code verification.
- Add test cases for 2FA functionality (`TwoFactorAuthTest.php`) and coverage for login scenarios with 2FA.
- Update OpenAPI specifications to include 2FA flows (`auth/2fa/setup`, `auth/2fa/enable`, `auth/2fa/verify`, `auth/2fa/disable`).
2026-02-23 17:00:18 +01:00
Jeppe Bundgaard 827fafd46b Add validation to prevent duplicate company phone numbers during customer registration 2026-02-23 16:30:51 +01:00
Jeppe Bundgaard c5840c0f3e Add self-serve module loading, enum test, and update email styles/text
- Add `SelfserveLaneServicesEnumTest` to validate `selfserve_lane_services` cases.
- Update `index.php` to load self-serve module interfaces, traits, classes, helpers, and configs.
- Center Truck Wash logo in email header and adjust styling.
- Localize password reset error message in `authRoute.php` with Danish text.
2026-02-18 15:35:41 +01:00
Jeppe Bundgaard 241a05e498 Send additional welcome emails to info@truckwash.dk and jm@truckwash.dk when creating new customers 2026-02-16 15:44:53 +01:00
Jeppe Bundgaard 4248de1d7d Add password reset link generation and welcome email functionality
- Introduce `generatePasswordResetLink` method in `users_o` for creating secure password reset links.
- Add `sendWelcomeEmailToCustomer` method to `email` class with support for attachments.
- Update `authRoute.php` to send welcome emails when creating new customers.
- Extend `sendEmail` to handle optional attachments and references.
- Disable PHP entrypoint in Dockerfile for improved flexibility.
2026-02-16 14:55:01 +01:00
Jeppe Bundgaard 64faea9324 Add password reset endpoint and refactor booking count logic
- Introduce `POST /auth/password-reset/request` endpoint in test and `authRoute.php`.
- Refactor bookings route to use a new method `getDailyUnfulfilledBookingsCountForDepartment`
2026-01-22 14:38:54 +01:00
Jeppe Bundgaard da9ee98fb5 Add password reset request endpoint to authentication routes; update OpenAPI spec and improve user email handling in users_o 2026-01-19 11:17:35 +01:00
Jeppe Bundgaard 09b5c618ed Add fine-grained permission checks for viewing department self-serve tasks and implement password reset endpoints (validate and set) in authentication routes; update OpenAPI spec accordingly. 2026-01-19 10:57:09 +01:00
Jeppe Bundgaard 60244dd106 Ensure error handling for invalid json_decode output by adding array validation checks across routes, traits, and response methods. Replace echo statements with standardized response error handling in module_config_t. 2026-01-13 11:56:17 +01:00
Jeppe Bundgaard 829a1b71e4 Remove contactName from required parameters in authRoute. 2026-01-08 13:17:03 +01:00
Jeppe Bundgaard 0d96bf6219 Trim registration input in vehicle creation and add contactName parameter to OpenAPI spec and related routes. 2026-01-08 13:16:32 +01:00
Jeppe Bundgaard 0cf7b99440 Add conditional validation and default handling for email and phone parameters in authRoute
- Introduced parameter checks to ensure validation only occurs if fields are set and non-empty.
- Added default values for missing `email` and `phone` fields to improve robustness.
- Adjusted logic to use `companyPhone` and default email (`jb@truckwash.dk`) when applicable.
2025-11-19 13:28:29 +01:00
Jeppe Bundgaard 5b01644c0a Add CVR handling to guest and auth routes with virkdata integration
- Introduced `/guest/cvr/search` endpoint in `guestRoute` for company search using CVR.
- Added `/auth/register/cvr` endpoint in `authRoute` to handle CVR-based registration with validation.
- Enhanced `virkdata` with `searchCompanies` and improved response handling for search requests.
- Updated E-conomic integration to check for existing CVR registrations and create new customers where needed.
2025-11-17 13:20:12 +01:00
Jepp9350 172e37d3a2 Add reCAPTCHA support and enhance Economic configurations
Introduce reCAPTCHA integration with validation and configuration handling. Update Economic module to include layout management and dynamic configuration via API. Added traits for managing module settings and encapsulated new endpoint routes for expanded functionality.
2025-02-10 15:27:32 +01:00
Jepp9350 707df910b0 Refactor: migrate files 2025-01-29 14:27:44 +01:00