mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-07 10:54:41 -04: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;
|
||||
|
||||
use App\Models\Account;
|
||||
use App\Models\Contact;
|
||||
use App\Models\Invitation;
|
||||
use App\Models\ProposalInvitation;
|
||||
use Auth;
|
||||
use Utils;
|
||||
use Closure;
|
||||
use Session;
|
||||
|
||||
@ -99,7 +101,21 @@ class Authenticate
|
||||
if ($request->ajax()) {
|
||||
return response('Unauthorized.', 401);
|
||||
} 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;
|
||||
}
|
||||
|
||||
public static function getSubdomain($url)
|
||||
public static function getSubdomain($url = false)
|
||||
{
|
||||
if (! $url) {
|
||||
$url = Request::server('HTTP_HOST');
|
||||
}
|
||||
|
||||
$parts = parse_url($url);
|
||||
$subdomain = '';
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user