mirror of
				https://github.com/invoiceninja/invoiceninja.git
				synced 2025-11-03 22:27:31 -05:00 
			
		
		
		
	Merge: We can't find a user with that e-mail address
This commit is contained in:
		
							parent
							
								
									1633f30a38
								
							
						
					
					
						commit
						1bd99880bd
					
				@ -2,10 +2,12 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
namespace App\Http\Middleware;
 | 
					namespace App\Http\Middleware;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					use App\Models\Account;
 | 
				
			||||||
use App\Models\Contact;
 | 
					use App\Models\Contact;
 | 
				
			||||||
use App\Models\Invitation;
 | 
					use App\Models\Invitation;
 | 
				
			||||||
use App\Models\ProposalInvitation;
 | 
					use App\Models\ProposalInvitation;
 | 
				
			||||||
use Auth;
 | 
					use Auth;
 | 
				
			||||||
 | 
					use Utils;
 | 
				
			||||||
use Closure;
 | 
					use Closure;
 | 
				
			||||||
use Session;
 | 
					use Session;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -99,7 +101,21 @@ class Authenticate
 | 
				
			|||||||
            if ($request->ajax()) {
 | 
					            if ($request->ajax()) {
 | 
				
			||||||
                return response('Unauthorized.', 401);
 | 
					                return response('Unauthorized.', 401);
 | 
				
			||||||
            } else {
 | 
					            } else {
 | 
				
			||||||
                return redirect()->guest($guard == 'client' ? '/client/login' : '/login');
 | 
					                if ($guard == 'client') {
 | 
				
			||||||
 | 
					                    $url = '/client/login';
 | 
				
			||||||
 | 
					                    if (Utils::isNinja()) {
 | 
				
			||||||
 | 
					                        if ($account && Utils::getSubdomain() == 'app') {
 | 
				
			||||||
 | 
					                            $url .= '?account_key=' . $account->account_key;
 | 
				
			||||||
 | 
					                        }
 | 
				
			||||||
 | 
					                    } else {
 | 
				
			||||||
 | 
					                        if ($account && Account::count() > 1) {
 | 
				
			||||||
 | 
					                            $url .= '?account_key=' . $account->account_key;
 | 
				
			||||||
 | 
					                        }
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                } else {
 | 
				
			||||||
 | 
					                    $url = '/login';
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					                return redirect()->guest($url);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -1003,8 +1003,12 @@ class Utils
 | 
				
			|||||||
        return $str;
 | 
					        return $str;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public static function getSubdomain($url)
 | 
					    public static function getSubdomain($url = false)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
 | 
					        if (! $url) {
 | 
				
			||||||
 | 
					            $url = Request::server('HTTP_HOST');
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $parts = parse_url($url);
 | 
					        $parts = parse_url($url);
 | 
				
			||||||
        $subdomain = '';
 | 
					        $subdomain = '';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user