Commit Graph

84 Commits

Author SHA1 Message Date
Mike Gilfillan 2558ee965c
Replace env() usage within app (#735)
env() will always return the default value when used outside of config
files if the config has been cached
2025-03-26 14:42:41 +01:00
Julien Nahum d63ecd43cc Refactor Form Submission and Field Management Logic
- Simplified the constructor in StoreFormSubmissionJob for improved readability.
- Enhanced the storeFile method to handle null and empty values more robustly, ensuring better validation of file names.
- Updated StorageFileNameParser to return null for empty file names, improving error handling.
- Refactored OpenForm.vue to optimize form initialization and prevent unnecessary reinitializations, enhancing performance.
- Introduced new methods for managing field groups and preventing recursive updates in OpenForm.vue, improving the overall user experience.
- Enhanced FormEditorSidebar.vue to utilize Pinia store for better state management and clarity.
- Improved FormFieldEdit.vue to prevent page jumps during field editing, ensuring a smoother user experience.
- Added new getters in working_form.js for better page management and navigation within forms.

These changes aim to enhance the maintainability and performance of the form handling logic, providing a more efficient and user-friendly experience.
2025-03-25 18:42:53 +01:00
Chirag Chhatrala 61e9493e1e
Add Template Creation Functionality in Admin Panel (#729)
* Add create template functionality in Admin Panel

- Implemented a new endpoint for creating templates in AdminController, utilizing the GenerateTemplate command.
- Added a form in the admin settings Vue component to allow users to input a template description and submit it.
- Enhanced the user experience with loading states and success/error alerts during template creation.

These changes facilitate the generation of new form templates directly from the admin interface, improving usability and functionality.

* Update template prompt validation length in AdminController

- Increased the maximum length of the 'template_prompt' field from 1000 to 4000 characters in the createTemplate method.

This change allows for more extensive template descriptions, enhancing the flexibility of template creation in the admin panel.

* Refactor template generation to use job-based approach

- Migrate template generation logic from the GenerateTemplate command to a new GenerateTemplateJob class for improved separation of concerns and better handling of asynchronous processing.
- Update AdminController to utilize the new job for generating templates, enhancing maintainability and clarity in the codebase.
- Remove unused dependencies and streamline the command's handle method for better performance and readability.

* fix lint

---------

Co-authored-by: Julien Nahum <julien@nahum.net>
2025-03-25 12:14:09 +01:00
Chirag Chhatrala fba2207e0f
Add 'exists_in_submissions' and 'does_not_exist_in_submissions' valid… (#725)
* Add 'exists_in_submissions' and 'does_not_exist_in_submissions' validation conditions

- Implement new validation conditions in FormLogicConditionChecker to check for existing submissions.
- Update open_filters.json and client-side filters to include the new conditions.
- Enhance FormLogicTest with test cases for the new validation conditions.
- Modify UI components to support the new logic conditions in form validation.

* Fix FormLogicConditionChecker

* Improve custom_validation_only

* fix test

---------

Co-authored-by: Julien Nahum <julien@nahum.net>
2025-03-25 11:50:59 +01:00
Chirag Chhatrala 2c746437c9
Re-login modal (#717)
* Implement quick login/register flow with global event handling

- Add QuickRegister component with improved modal management
- Integrate quick login/register with app store state
- Implement custom event handling for login/registration flow
- Update OAuth callback to support quick login in popup windows
- Refactor authentication-related components to use global events

* Refactor authentication flow with centralized useAuth composable

- Create new useAuth composable to centralize login, registration, and social login logic
- Simplify authentication methods in LoginForm and RegisterForm
- Add event-based login/registration flow with quick login support
- Remove redundant API calls and consolidate authentication processes
- Improve error handling and analytics tracking for authentication events

* Enhance QuickRegister and RegisterForm components with unauthorized error handling

- Add closeable functionality to modals based on unauthorized error state
- Implement logout button in QuickRegister for unauthorized users
- Reset unauthorized error state on component unmount
- Update styling for "OR" text in RegisterForm for consistency
- Set unauthorized error flag in app store upon 401 response in API calls

* Refactor Authentication Flow and Remove Unused Callback Views

- Deleted unused callback views for Notion and OAuth to streamline the codebase.
- Updated QuickRegister and LoginForm components to remove the after-login event emission, replacing it with a window message system for better communication between components.
- Enhanced the RegisterForm and other components to utilize the new window message system for handling login completion, improving reliability and maintainability.
- Added a verifyAuthentication method in the useAuth composable to ensure user data is loaded correctly after social logins, including retry logic for fetching user data.

These changes aim to simplify the authentication process and improve the overall user experience by ensuring a more robust handling of login events.

* Add eslint-disable comment to useWindowMessage composable for linting control

* Refactor QuickRegister.vue for improved template structure and clarity

- Adjusted the rendering of horizontal dividers and the "or" text for better semantic HTML.
- Added a compact-header prop to the modal for enhanced layout control.

These changes aim to enhance the readability and maintainability of the QuickRegister component.

---------

Co-authored-by: Julien Nahum <julien@nahum.net>
2025-03-25 10:41:11 +01:00
Chirag Chhatrala aa5c1acf3a
Decouple title from title block (#696)
* Decouple title from title block

* fix lint

* remove dry run for FormTitleMigration

* Skip form title migration for forms with hidden titles

* Refactor AI Form Generation with Dedicated Prompt Services

- Extract AI form generation logic from GenerateTemplate command into dedicated prompt service classes
- Update GenerateAiForm job to use new prompt generation services
- Improve GptCompleter with more robust error handling and token tracking
- Add error field to AiFormCompletion model for better error logging
- Simplify command signature from 'ai:make-form-template' to 'form:generate'

* Consolidate Template Metadata Generation with Unified Prompt Service

- Create GenerateTemplateMetadataPrompt to centralize template metadata generation
- Update GenerateTemplate command to use new consolidated metadata generation approach
- Enhance GptCompleter to support strict JSON schema validation
- Increase form prompt max length to support more complex form descriptions
- Refactor form generation to simplify metadata extraction and processing

* Implement Form Mode Strategy for Flexible Form Rendering

- Introduce FormModeStrategy to centralize form rendering logic
- Add support for different form modes: LIVE, PREVIEW, TEST, EDIT, PREFILL
- Refactor components to use mode-based rendering strategy
- Remove legacy boolean props like adminPreview and creating
- Enhance form component flexibility and reusability

* Refine Form Mode Strategy Display Behavior

- Update FormModeStrategy to hide hidden fields in PREVIEW mode
- Add FormMode getter in UrlFormPrefill component for mode-specific rendering
- Clarify mode-specific validation and display logic in form strategies

* Enhance Form Template Generation with Advanced Field Options

- Update GenerateTemplate command to use front_url for template URL output
- Expand GenerateFormPrompt with comprehensive field configuration options
- Add support for advanced field types: date with time, toggle switches, radio/checkbox selections
- Introduce field width configuration and HTML formatting for text elements
- Re-enable select, multi-select, and matrix field type definitions with enhanced configurations

* Remove Deprecated Template Metadata Generation Services

- Delete multiple AI prompt services related to template metadata generation
- Simplify GenerateTemplate command to use default values instead of complex metadata generation
- Remove GenerateTemplateMetadataPrompt and related classes like GenerateTemplateDescriptionPrompt, GenerateTemplateImageKeywordsPrompt, etc.
- Update form template generation to use basic fallback metadata generation approach

* Restore GenerateTemplateMetadataPrompt for Comprehensive Template Generation

- Reintroduce GenerateTemplateMetadataPrompt to replace default metadata generation
- Update GenerateTemplate command to use consolidated metadata generation approach
- Extract detailed metadata components including title, description, industries, and image search query
- Improve template generation with more dynamic and AI-generated metadata

* Refactor Template Preview Section Layout

- Remove unnecessary nested div in template preview section
- Simplify HTML structure for the template preview component
- Maintain existing styling and functionality while improving code readability

* Refactor Constructor and Code Formatting in AI Form Generation and Prompt Classes

- Updated the constructor in GenerateAiForm.php to use a block structure for improved readability and consistency.
- Added a blank line in the Prompt.php file to enhance code formatting and maintain consistency with PHP coding standards.
- Modified the migration file to use a more concise class declaration syntax, improving clarity.

These changes aim to enhance code readability and maintainability across the affected files.

---------

Co-authored-by: Julien Nahum <julien@nahum.net>
2025-03-21 16:59:18 +01:00
Julien Nahum d2b8572d75 Update Docker Documentation to Address Line Ending Issues for Windows Users
- Added a warning for Windows users regarding the importance of maintaining LF (Unix-style) line endings in script files to prevent Docker containers from hanging during startup.
- Included instructions for configuring Git to preserve line endings and fixing the artisan script using dos2unix or sed commands.
- Added a note about potential line ending issues that may arise when using Git or code editors on Windows, emphasizing the need for LF line endings in the `artisan` script.

These changes aim to improve the documentation clarity and assist users in resolving common issues related to line endings when deploying with Docker.
2025-03-21 16:30:59 +01:00
Chirag Chhatrala 37a10cbdfa
Add regex matching filters to open_filters.json (#722)
* Add regex matching filters to open_filters.json

- Introduce new regex-based filters: matches_regex and does_not_match_regex
- Add support for string-based regex matching in both API and client filter configurations
- Update filter schemas to include new regex filter options with expected string type

* Add barcode comparators and regex filters to open_filters.json and validatePropertiesLogic.js

- Introduce new barcode comparators: equals, does_not_equal, contains, does_not_contain, starts_with, ends_with, is_empty, is_not_empty, matches_regex, does_not_match_regex, content_length_equals, content_length_does_not_equal, content_length_greater_than, content_length_greater_than_or_equal_to, content_length_less_than, content_length_less_than_or_equal_to.
- Add regex matching filters: matches_regex and does_not_match_regex to open_filters.json.
- Remove console log statements from validatePropertiesLogic.js and FormPropertyLogicRule.js for cleaner code.

This update enhances the filtering capabilities and improves the validation logic by removing unnecessary debug outputs.

* Refactor Vue Components for Improved Readability and Consistency

- Update CameraUpload.vue to enhance formatting and maintain consistent indentation for better readability.
- Modify OpenFormField.vue to improve tooltip component formatting, ensuring consistent styling across the application.
- Refactor FormSecurityAccess.vue to enhance the layout of the conditional rendering for captcha providers.
- Adjust RegisterForm.vue to improve the formatting of the terms and conditions section, ensuring consistent indentation and readability.

These changes aim to enhance code maintainability and visual consistency across the components, contributing to a cleaner codebase.

---------

Co-authored-by: Julien Nahum <julien@nahum.net>
2025-03-15 13:55:42 +08:00
Chirag Chhatrala 7b942997ce
Hidden field can never be required. Skip that validation (#716)
* Hidden field can never be required. Skip that validation

* Refactor form logic editor UI with improved text and styling

- Replace UAlert with plain text description
- Update action description text
- Remove help text from select input
- Simplify note about hidden field requirements

* Add test for form logic field visibility and validation

- Implement test case for fields hidden by logic conditions
- Update AnswerFormRequest to use new FormLogicPropertyResolver method for hidden field check
- Ensure required fields are skipped when hidden by form logic

---------

Co-authored-by: Julien Nahum <julien@nahum.net>
2025-03-12 14:47:06 +08:00
Julien Nahum a5162192b1
Enhance JWT Token Management and Authentication Flow (#720)
- Implement extended token lifetime for "Remember Me" functionality
- Add token expiration details to authentication responses
- Update client-side token handling to support dynamic expiration
- Modify authentication middleware to handle token initialization more robustly
- Configure JWT configuration to support longer token lifetimes
2025-03-10 17:32:17 +08:00
Julien Nahum 06328a47ab Enhance Tax Export Command with Comprehensive Invoice Processing and Metrics
- Improve invoice processing with advanced error handling and tracking
- Add detailed volume metrics for USD and EUR
- Implement robust country detection with multiple fallback strategies
- Enhance logging and progress tracking during tax export generation
- Add performance timing and more granular invoice exclusion reporting
2025-03-10 17:25:15 +08:00
Julien Nahum 8894880cb9 Improve Email Notification Message-ID and Threading Generation
- Refactor email header generation for form submission notifications
- Use MD5 hashed submission ID for more consistent message threading
- Remove timestamp from Message-ID and Thread-Index generation
- Ensure emails are threaded only by submission ID
- Simplify header creation logic for better email client compatibility
2025-03-06 13:21:12 +08:00
Julien Nahum b633f97ce1 Refactor FormSubmissionDataFactory to use TestHelpers trait
- Move FormSubmissionDataFactory methods into TestHelpers trait
- Update import statements across multiple test files
- Remove standalone FormSubmissionDataFactory class
- Simplify form submission data generation in tests
- Add documentation for new generateFormSubmissionData method
2025-03-04 13:38:33 +08:00
Julien Nahum cf4688d75e Improve numeric condition handling in form logic checker
- Add robust numeric comparison for zero and negative numbers
- Implement safe numeric parsing and validation
- Enhance condition checking for numeric fields across PHP and JavaScript
- Add comprehensive test cases for edge case numeric comparisons
- Fix 'is_not_empty' operator logic in JavaScript condition checker
2025-03-03 19:29:40 +08:00
Julien Nahum b388c729ce Refactor Stripe subscription line item management in WorkspaceUsersUpdated job
- Improve handling of extra user line items in Stripe subscriptions
- Add logic to remove line item when quantity is zero
- Optimize line item creation and update process
- Simplify environment check using app() helper method
2025-02-27 15:04:38 +08:00
Chirag Chhatrala 308ce7031a
Add localized 'Yes' and 'No' translations for checkbox fields (#710) 2025-02-24 17:08:37 +08:00
Chirag Chhatrala 65eebb7277
Fix redirect URL mentions (#707) 2025-02-24 16:11:30 +08:00
Julien Nahum 28248259be Improve form property logic validation for checkbox conditions
- Update FormPropertyLogicRule to handle operators without values
- Add support for checkbox conditions like 'is_checked' and 'is_not_checked'
- Refactor logic validation in both API and client-side implementations
- Remove unnecessary console.log statements
- Update error modal text for better user experience
2025-02-19 15:11:27 +01:00
Julien Nahum 0d6bd1bfde Update Vapor deployment configuration
Remove redundant `php artisan event:cache` and `php artisan optimize` steps in build and deploy processes
2025-02-15 09:18:27 +00:00
Chirag Chhatrala e7585c32d3
Refactor form property logic rule to load condition mapping from external JSON file (#698)
* Refactor form property logic rule to load condition mapping from external JSON file

* fix CONDITION_MAPPING

* use config file for load mapping

* Simplify condition mapping retrieval in FormPropertyLogicRule

---------

Co-authored-by: Julien Nahum <julien@nahum.net>
2025-02-14 22:32:55 +00:00
Chirag Chhatrala 82fae97a3e
Clean up empty HTML and help text in form inputs (#700)
* Clean up empty HTML and help text in form inputs

* Update api/app/Http/Requests/UserFormRequest.php

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

---------

Co-authored-by: Julien Nahum <julien@nahum.net>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2025-02-14 15:23:09 +00:00
Chirag Chhatrala c819e76463
On duplicate form re-generate slug (#703)
* when duplicate remove removed_properties

* when duplicate remove removed_properties

* On duplicate form re-generate slug

* On duplicate form re-generate slug
2025-02-14 15:15:10 +00:00
Chirag Chhatrala 33bd85fd2c
when duplicate form remove removed_properties (#702)
* when duplicate remove removed_properties

* when duplicate remove removed_properties
2025-02-13 15:23:51 +01:00
Chirag Chhatrala aae28d09cc
Add workspace update functionality (#699)
* Add workspace update functionality

* Refactor workspace settings header layout and edit button styling

* Update workspace route and API endpoint to use root path

---------

Co-authored-by: Julien Nahum <julien@nahum.net>
2025-02-12 13:43:55 +01:00
Julien Nahum 853760484c Enhance form logic property resolver and validation UI
- Refactor `shouldBeRequired()` method in FormLogicPropertyResolver for clearer logic and better handling of conditional requirements
- Add comprehensive test cases for dynamic field requirement logic
- Update CustomFieldValidation component with improved UI and guidance for validation setup
- Improve error message and validation rule description in form validation interface
2025-02-11 15:09:21 +01:00
Julien Nahum f5b9b86c16 Refactor checkbox condition logic with new operators
- Replace legacy 'equals' and 'does_not_equal' checkbox operators with 'is_checked' and 'is_not_checked'
- Update FormLogicConditionChecker in PHP and JavaScript to handle new operators
- Modify open_filters.json to reflect new checkbox comparator structure
- Add migration logic in ColumnCondition.vue to support legacy operator conversion
- Improve checkbox condition handling with explicit true/false checks
2025-02-10 22:03:19 +01:00
Chirag Chhatrala 9df70b97c7
Add support for additional language locales (#693)
Co-authored-by: Julien Nahum <julien@nahum.net>
2025-02-10 12:33:52 +01:00
Julien Nahum f350ed778c Refactor form submission processing with new FormSubmissionProcessor
- Introduce FormSubmissionProcessor service to handle synchronous/asynchronous form submission logic
- Modify PublicFormController to use new processor for submission and redirect handling
- Update StoreFormSubmissionJob to support processed data retrieval
- Add comprehensive test suite for FormSubmissionProcessor
- Improve handling of generated fields and redirect URL processing
2025-02-01 22:52:20 +01:00
Julien Nahum 5f0f873fb2 Add configuration option to hide official templates
Introduce a new environment variable and configuration option to allow users to hide official templates in the template gallery. This provides more flexibility for self-hosted instances of OpnForm.
2025-02-01 21:14:28 +01:00
Julien Nahum f7df6bc0d7 Refactor Docker configuration and development setup
- Update .dockerignore with comprehensive ignore patterns for API and client
- Modify docker-compose files to improve service configurations
- Enhance Nginx configuration for development and production environments
- Refactor Dockerfile.api with improved build process
- Add docker-setup.sh script for simplified Docker deployment
- Update update-credentials.vue page with improved UI
- Remove hCaptcha dependency from package-lock.json
- Update PHP configuration and entrypoint scripts
2025-01-29 17:19:36 +01:00
Chirag Chhatrala 4fae4e6328
Enhance email settings functionality by adding sender address support (#668)
Co-authored-by: Julien Nahum <julien@nahum.net>
2025-01-27 16:07:01 +01:00
Julien Nahum a67dff14a4 Fixed linting 2025-01-16 10:09:54 +01:00
Julien Nahum 9bf83d5f89 Enhance Tax Export Command Date Handling
- Improved date validation logic in the GenerateTaxExport command.
- Added default start date as the first day of the previous month if not specified, with user confirmation.
- Set default end date to the end of the month based on the start date if not provided.
- Refactored date formatting for better readability and consistency in log messages.
- Enhanced the clarity of the progress bar query options by formatting the expand array.

These changes improve user experience by providing sensible defaults for date inputs and ensuring clear communication of the command's actions.
2025-01-14 14:40:26 +01:00
Julien Nahum 747b41d0a6 Add error logging for integration failures in AbstractIntegrationHandler
- Introduced logging of integration failures to capture detailed error information.
- Enhanced error handling by logging the form ID and integration ID along with the exception data.

These changes improve the observability of integration processes, aiding in debugging and monitoring.
2025-01-14 14:34:03 +01:00
Julien Nahum e3fd709326 Refactor Email Integration Handling
- Removed the AbstractEmailIntegrationHandler class to streamline email integration logic.
- Updated EmailIntegration class to extend AbstractIntegrationHandler instead of the removed class.
- Modified FormEmailNotification to handle mailer configuration internally, eliminating the need to pass the mailer as a parameter.

These changes enhance the clarity and maintainability of the email integration process by consolidating configuration logic and reducing class dependencies.
2025-01-14 13:29:09 +01:00
Chirag Chhatrala cc62f614e4
Enhance Form Submission Export Functionality (#657)
* Enhance Form Submission Export Functionality

* Validate new param 'columns'

* Form submission export request as seprate class with validation

* Test case for export

---------

Co-authored-by: Julien Nahum <julien@nahum.net>
2025-01-07 15:04:02 +01:00
Chirag Chhatrala b0311257ac
improve s3key exception (#661) 2025-01-06 12:52:20 +01:00
Chirag Chhatrala 2366f9515d
Readonly User (#637)
* Readonly User

* Refactor FormPolicy and TemplatePolicy to centralize write operation logic

- Introduced a private method `canPerformWriteOperation` in both FormPolicy and TemplatePolicy to encapsulate the logic for determining if a user can perform write operations on the respective models.
- Updated the `update`, `delete`, `restore`, and `forceDelete` methods in FormPolicy to use the new method for improved readability and maintainability.
- Simplified the `update` and `delete` methods in TemplatePolicy to leverage the centralized write operation logic.

This refactoring enhances code clarity and reduces duplication across policy classes.

* Refactor user and workspace permissions handling

- Updated FormController to authorize form creation based on workspace context.
- Removed the `is_readonly` attribute from UserResource and integrated it into WorkspaceResource for better encapsulation.
- Refactored User model to eliminate the `getIsReadonlyAttribute` method, shifting readonly logic to the Workspace model.
- Adjusted FormPolicy and TemplatePolicy to utilize workspace readonly checks for user permissions.
- Updated various frontend components to reference workspace readonly status instead of user readonly status, enhancing clarity and consistency in permission handling.

These changes improve the management of user permissions in relation to workspaces, ensuring a more robust and maintainable authorization system.

* Fix isReadonlyUser

* fix pint

---------

Co-authored-by: Julien Nahum <julien@nahum.net>
2024-12-30 14:35:23 +01:00
Chirag Chhatrala 9a2d7b9d8d
On slack,discord add support for Include hidden fields (#654) 2024-12-30 11:11:17 +01:00
Chirag Chhatrala 3d9bc60ca1
Evaluate custom validation rules first (#655) 2024-12-30 11:00:10 +01:00
Chirag Chhatrala d18c4cc9bf
ESC-417-date-input-is-not-showing-in-google-sheet (#653) 2024-12-19 13:34:41 +01:00
Chirag Chhatrala d7ce8536c8
Add reCAPTCHA support and update captcha provider handling (#647)
* Add reCAPTCHA support and update captcha provider handling

- Introduced reCAPTCHA as an additional captcha provider alongside hCaptcha.
- Updated form request validation to handle different captcha providers based on user selection.
- Added a new validation rule for reCAPTCHA.
- Modified the forms model to include a 'captcha_provider' field.
- Created a migration to add the 'captcha_provider' column to the forms table.
- Updated frontend components to support dynamic rendering of captcha based on the selected provider.
- Enhanced tests to cover scenarios for both hCaptcha and reCAPTCHA.

These changes improve the flexibility of captcha options available to users, enhancing form security and user experience.

* fix pint

* change comment text

* Refactor captcha implementation and integrate new captcha components

- Removed the old RecaptchaV2 component and replaced it with a new implementation that supports both reCAPTCHA and hCaptcha through a unified CaptchaInput component.
- Updated the OpenForm component to utilize the new CaptchaInput for dynamic captcha rendering based on user-selected provider.
- Cleaned up the package.json by removing the deprecated @hcaptcha/vue3-hcaptcha dependency.
- Enhanced form initialization to set a default captcha provider.
- Improved error handling and cleanup for both reCAPTCHA and hCaptcha scripts.

These changes streamline captcha integration, improve maintainability, and enhance user experience by providing a more flexible captcha solution.

* Refactor captcha error messages and localization support

* Refactor registration process to integrate reCAPTCHA

- Replaced hCaptcha implementation with reCAPTCHA in RegisterController and related test cases.
- Updated validation rules to utilize g-recaptcha-response instead of h-captcha-response.
- Modified RegisterForm component to support reCAPTCHA, including changes to the form data structure and component references.
- Enhanced test cases to reflect the new reCAPTCHA integration, ensuring proper validation and response handling.

These changes improve security and user experience during the registration process by adopting a more widely used captcha solution.

* Fix reCAPTCHA configuration and update RegisterForm styling

- Corrected the configuration key for reCAPTCHA in RegisterController from 'services.recaptcha.secret_key' to 'services.re_captcha.secret_key'.
- Updated the styling of the Captcha input section in RegisterForm.vue to improve layout consistency.

These changes ensure proper reCAPTCHA functionality and enhance the user interface during the registration process.

* Fix reCAPTCHA configuration in RegisterTest to use the correct key format

- Updated the configuration key for reCAPTCHA in RegisterTest from 'services.recaptcha.secret_key' to 'services.re_captcha.secret_key' to ensure proper functionality during tests.

This change aligns the test setup with the recent updates in the reCAPTCHA integration, improving the accuracy of the registration process tests.

---------

Co-authored-by: Julien Nahum <julien@nahum.net>
2024-12-18 16:35:09 +01:00
Chirag Chhatrala 7365479c83
Email spam security (#641)
* Add hCaptcha on register page

* register page captcha test cases

* Refactor integration validation rules to include form context

- Updated the `getValidationRules` method in various integration handlers (Discord, Email, Google Sheets, Slack, Webhook, Zapier) to accept an optional `Form` parameter, allowing for context-aware validation.
- Enhanced the `EmailIntegration` handler to enforce restrictions based on user plans, ensuring free users can only create one email integration per form and can only send to a single email address.
- Added a new test suite for `EmailIntegration` to validate the new restrictions and ensure proper functionality for both free and pro users.
- Introduced loading state management in the `IntegrationModal` component to improve user experience during save operations.

These changes improve the flexibility and user experience of form integrations, particularly for email handling.

* for self-hosted ignore emil validation for spam

* fix pint

* ignore register throttle for testing env

* support new migration for mysql also

* Register page captcha enable if captcha key set

* fix test case

* fix test case

* fix test case

* fix pint

* Refactor RegisterController middleware and update TestCase setup

- Removed environment check for throttling middleware in RegisterController, ensuring consistent rate limiting for the registration endpoint.
- Updated TestCase to disable throttle middleware during tests, allowing for more flexible testing scenarios without rate limiting interference.

* Enhance hCaptcha integration in tests and configuration

- Added hCaptcha site and secret keys to phpunit.xml for testing purposes.
- Updated RegisterTest to configure hCaptcha secret key dynamically, ensuring proper token validation in production environment.

These changes improve the testing setup for hCaptcha, facilitating more accurate simulation of production conditions.

---------

Co-authored-by: Julien Nahum <julien@nahum.net>
2024-12-18 13:16:27 +01:00
Chirag Chhatrala c1ee072b71
Improve Integration Cards (#643)
* Add integration action components and update integration JSON files

- Introduced new action components for Email, Slack, Discord, Webhook, and Google Sheets integrations, enhancing the user interface for managing these integrations.
- Updated the `integrations.json` files to include `actions_file_name` for each integration, linking them to their respective action components.
- Improved the `GoogleSheetsIntegrationActions.vue` component by replacing direct provider information display with a badge for better UI consistency.

These changes aim to streamline integration management and improve the overall user experience.

* Minor UI fixes

---------

Co-authored-by: Julien Nahum <julien@nahum.net>
2024-12-18 13:07:19 +01:00
Chirag Chhatrala 28019fc7a0
Implement regex validation conditions in form logic (#645)
* Implement regex validation conditions in form logic

- Added support for 'matches_regex' and 'does_not_match_regex' conditions in FormPropertyLogicRule and FormLogicConditionChecker.
- Updated validation logic to handle regex patterns, including error handling for invalid patterns.
- Enhanced tests to cover scenarios for successful and failed regex validation, ensuring proper feedback for form submissions.
- Updated JSON schema to include new regex condition types.

These changes improve the flexibility of form validation by allowing regex-based conditions, enhancing user experience through more robust validation mechanisms.

* update resource filters

* Remove ray

---------

Co-authored-by: Julien Nahum <julien@nahum.net>
2024-12-16 17:17:29 +01:00
Chirag Chhatrala 20405ee606
Send mobile editor email (#634)
Co-authored-by: Julien Nahum <julien@nahum.net>
2024-12-12 11:19:09 +01:00
Chirag Chhatrala ea4cd85eae
Enhance redirect URL handling and MentionParser functionality (#639)
- Updated the `redirect_url` validation in `UserFormRequest` to accept strings instead of just max length.
- Modified `MentionParser` to include a `urlFriendlyOutput` method, allowing for URL encoding of special characters in parsed values.
- Adjusted the `PublicFormController` to utilize the new `urlFriendlyOutput` method for redirect URLs.
- Created a migration to change the `redirect_url` field type in the database from string to text, accommodating longer URLs.
- Added tests to ensure proper handling of long redirect URLs and the functionality of the new URL-friendly output feature in `MentionParser`.

This update improves the flexibility and robustness of form handling and URL processing.
2024-12-10 12:26:01 +01:00
Julien Nahum d09b5c45a5 Update validation messages for clarity in English and Spanish
- Revised the 'invalid_json' validation message in both English and Spanish to enhance clarity and user understanding. The new messages are more concise and direct, improving the overall user experience when inputting data.
2024-12-09 20:28:34 +01:00
Julien Nahum 705c84dae4 Enhance language support and fix validation messages
- Added support for additional languages (Bengali, Portuguese, Russian, Urdu, Punjabi, German, Javanese, Korean, Vietnamese, Telugu, Marathi, Tamil, Turkish) in the application.
- Updated validation messages across multiple languages to correct formatting issues and improve clarity, including Arabic, English, Spanish, French, Hindi, Japanese, Norwegian, and Chinese.
- Removed obsolete Norwegian language files to streamline localization efforts.
- Improved the language selection interface in the form customization component.

These changes aim to enhance user experience by providing better language support and clearer validation feedback.
2024-12-09 12:47:01 +01:00
Chirag Chhatrala daca69267b
Form Translation (#616)
* Form Translation

* Support for other languages

* Support locale for datepicker

* Apply translation on select input

* Apply translation on select input

* Improve translation

---------

Co-authored-by: Julien Nahum <julien@nahum.net>
2024-12-04 18:32:14 +01:00