A FreeScout module that adds the ability to redirect unauthenticated users from the End User Portal to the authentication page.
This module enhances the FreeScout End User Portal by providing administrators with the option to require authentication before users can submit support tickets. When enabled, any unauthenticated visitor attempting to access the portal will be automatically redirected to the login page.
- Simple Checkbox Setting: Enable/disable redirection per mailbox through the End User Portal settings
- Seamless Integration: Works with the existing FreeScout authentication system
- No Core Modifications: Built as a standalone module without modifying FreeScout core files
- Secure Implementation: Server-side redirect ensures security cannot be bypassed
- FreeScout installation
- End User Portal module installed and activated
- PHP 7.2 or higher
-
Download or clone this repository into your FreeScout
Modulesdirectory:cd /path/to/freescout/Modules git clone https://github.com/Minim-Digital/FreeScout-Redirect-Unauthenticated.git RedirectUnauthenticated -
Ensure proper permissions:
chown -R www-data:www-data RedirectUnauthenticated chmod -R 755 RedirectUnauthenticated
-
Clear the application cache:
php artisan cache:clear php artisan config:clear
-
Activate the module in FreeScout:
- Navigate to Manage > Modules
- Find "Redirect Unauthenticated Users" in the list
- Click Activate
- Navigate to Mailbox > Settings > End User Portal
- Look for the "Redirect unauthenticated users to login page" checkbox
- Check the box to enable redirection for this mailbox
- Click Save
When enabled, visitors to your portal URL (/help/{id}) will be redirected to the authentication page (/help/{id}/auth) if they are not logged in.
The module operates using several key mechanisms:
- View Override: Extends the End User Portal settings page to include the redirect checkbox
- Settings Storage: Stores the configuration in the mailbox meta data
- Middleware Integration: Intercepts portal requests and checks authentication status
- Smart Redirect: Only redirects on the main portal page, avoiding redirect loops
To verify the module is working correctly:
- Enable the redirect setting for a mailbox (as described above)
- Open an incognito/private browser window
- Navigate to your portal URL (e.g.,
https://support.example.com/help/abc123) - Verify you are redirected to the login page
- Disable the setting and verify normal access is restored
- Ensure the End User Portal module is installed and activated
- Clear the application cache
- Check file permissions
- Verify the module is activated
- Check Laravel logs for any errors:
storage/logs/laravel.log - Ensure proper write permissions on the database
- Confirm the setting is enabled and saved
- Clear browser cache and cookies
- Check that you're testing as an unauthenticated user (use incognito mode)
- This should not occur with proper installation
- If it does, deactivate the module and report the issue
RedirectUnauthenticated/
module.json # Module metadata
Providers/
RedirectUnauthenticatedServiceProvider.php # Core service provider
Resources/
views/
settings.blade.php # Settings page template
- Storage: Settings are stored in the
mailboxestable'smetaJSON column - Authentication: Uses Laravel's
Auth::guest()method to check user status - View System: Leverages Laravel's view namespace override functionality
- Event System: Integrates with FreeScout's routing events for settings persistence
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This module is open-sourced software licensed under the AGPL-3.0 license.
For issues, questions, or suggestions, please open an issue on the GitHub repository.
- Initial public release
- Basic redirect functionality for unauthenticated users
- Settings integration with End User Portal
- Built for FreeScout - Open Source Help Desk & Shared Inbox
- Requires the End User Portal module to function
Note: This module does not collect any user data or telemetry. All settings are stored locally in your FreeScout database.