mirror of
				https://github.com/invoiceninja/invoiceninja.git
				synced 2025-11-03 19:57:30 -05:00 
			
		
		
		
	* Fixes for tests * add additional fields for company settings * fixes for travis * update company settings schema * Disable client portal * Client Portal middleware * Working on client portal * hide portal * Implement notification channgels for User and ClientContact models * Push notifications onto queue * Force authentication if client portal is password protected
		
			
				
	
	
		
			49 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			49 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
<?php
 | 
						|
/**
 | 
						|
 * Invoice Ninja (https://invoiceninja.com)
 | 
						|
 *
 | 
						|
 * @link https://github.com/invoiceninja/invoiceninja source repository
 | 
						|
 *
 | 
						|
 * @copyright Copyright (c) 2019. Invoice Ninja LLC (https://invoiceninja.com)
 | 
						|
 *
 | 
						|
 * @license https://opensource.org/licenses/AAL
 | 
						|
 */
 | 
						|
 | 
						|
namespace App\Http\Middleware;
 | 
						|
 | 
						|
use Closure;
 | 
						|
use Illuminate\Support\Facades\Auth;
 | 
						|
 | 
						|
class RedirectIfAuthenticated
 | 
						|
{
 | 
						|
    /**
 | 
						|
     * Handle an incoming request.
 | 
						|
     *
 | 
						|
     * @param  \Illuminate\Http\Request  $request
 | 
						|
     * @param  \Closure  $next
 | 
						|
     * @param  string|null  $guard
 | 
						|
     * @return mixed
 | 
						|
     */
 | 
						|
    public function handle($request, Closure $next, $guard = null)
 | 
						|
    {
 | 
						|
      switch ($guard) {
 | 
						|
        case 'contact':
 | 
						|
          if (Auth::guard($guard)->check()) {
 | 
						|
             return redirect()->route('client.dashboard');
 | 
						|
          }
 | 
						|
          break;
 | 
						|
          case 'user':
 | 
						|
          if (Auth::guard($guard)->check()) {
 | 
						|
            return redirect()->route('dashboard.index');
 | 
						|
          }
 | 
						|
          break;
 | 
						|
        default:
 | 
						|
          if (Auth::guard($guard)->check()) {
 | 
						|
              return redirect('/');
 | 
						|
          }
 | 
						|
          break;
 | 
						|
      }
 | 
						|
      return $next($request);
 | 
						|
    }
 | 
						|
}
 |