Skip to content

Minim-Digital/FreeScout-Redirect-Unauthenticated

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 

Repository files navigation

FreeScout Redirect Unauthenticated Module

A FreeScout module that adds the ability to redirect unauthenticated users from the End User Portal to the authentication page.

Overview

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.

Features

  • 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

Requirements

  • FreeScout installation
  • End User Portal module installed and activated
  • PHP 7.2 or higher

Installation

  1. Download or clone this repository into your FreeScout Modules directory:

    cd /path/to/freescout/Modules
    git clone https://github.com/Minim-Digital/FreeScout-Redirect-Unauthenticated.git RedirectUnauthenticated
  2. Ensure proper permissions:

    chown -R www-data:www-data RedirectUnauthenticated
    chmod -R 755 RedirectUnauthenticated
  3. Clear the application cache:

    php artisan cache:clear
    php artisan config:clear
  4. Activate the module in FreeScout:

    • Navigate to Manage > Modules
    • Find "Redirect Unauthenticated Users" in the list
    • Click Activate

Configuration

  1. Navigate to Mailbox > Settings > End User Portal
  2. Look for the "Redirect unauthenticated users to login page" checkbox
  3. Check the box to enable redirection for this mailbox
  4. 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.

How It Works

The module operates using several key mechanisms:

  1. View Override: Extends the End User Portal settings page to include the redirect checkbox
  2. Settings Storage: Stores the configuration in the mailbox meta data
  3. Middleware Integration: Intercepts portal requests and checks authentication status
  4. Smart Redirect: Only redirects on the main portal page, avoiding redirect loops

Testing

To verify the module is working correctly:

  1. Enable the redirect setting for a mailbox (as described above)
  2. Open an incognito/private browser window
  3. Navigate to your portal URL (e.g., https://support.example.com/help/abc123)
  4. Verify you are redirected to the login page
  5. Disable the setting and verify normal access is restored

Troubleshooting

Setting Not Appearing

  • Ensure the End User Portal module is installed and activated
  • Clear the application cache
  • Check file permissions

Setting Not Saving

  • Verify the module is activated
  • Check Laravel logs for any errors: storage/logs/laravel.log
  • Ensure proper write permissions on the database

Redirect Not Working

  • Confirm the setting is enabled and saved
  • Clear browser cache and cookies
  • Check that you're testing as an unauthenticated user (use incognito mode)

Redirect Loop

  • This should not occur with proper installation
  • If it does, deactivate the module and report the issue

File Structure

RedirectUnauthenticated/
    module.json                              # Module metadata
    Providers/
        RedirectUnauthenticatedServiceProvider.php  # Core service provider
    Resources/
        views/
            settings.blade.php               # Settings page template

Technical Details

  • Storage: Settings are stored in the mailboxes table's meta JSON 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

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

This module is open-sourced software licensed under the AGPL-3.0 license.

Support

For issues, questions, or suggestions, please open an issue on the GitHub repository.

Changelog

Version 1.0.10

  • Initial public release
  • Basic redirect functionality for unauthenticated users
  • Settings integration with End User Portal

Acknowledgments

  • 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.

About

A FreeScout module that adds the ability to redirect unauthenticated users from the End User Portal to the authentication page.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors