mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-09-19 16:01:34 +02:00
We can't find a user with that e-mail address. #1444
This commit is contained in:
parent
501dd5b173
commit
041c89b4f8
@ -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…
Reference in New Issue
Block a user