1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-09-20 00:11:35 +02:00

We can't find a user with that e-mail address. #1444

This commit is contained in:
Hillel Coren 2018-02-24 22:20:21 +02:00
parent 501dd5b173
commit 041c89b4f8
2 changed files with 22 additions and 2 deletions

View File

@ -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);
}
}

View File

@ -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 = '';