1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 13:12:50 +01:00
This commit is contained in:
David Bomba 2022-03-13 21:40:29 +11:00
parent 58ac813130
commit 3e039538b6
5 changed files with 18 additions and 18 deletions

View File

@ -1 +1 @@
5.3.67
5.3.68

View File

@ -33,6 +33,7 @@ use App\Transformers\CompanyUserTransformer;
use App\Utils\Ninja;
use App\Utils\Traits\UserSessionAttributes;
use App\Utils\Traits\User\LoginCache;
use App\Utils\TruthSource;
use Google_Client;
use Illuminate\Foundation\Auth\AuthenticatesUsers;
use Illuminate\Http\Request;
@ -250,15 +251,6 @@ class LoginController extends BaseController
->increment()
->queue();
// SystemLogger::dispatch(
// json_encode(['ip' => request()->getClientIp()]),
// SystemLog::CATEGORY_SECURITY,
// SystemLog::EVENT_USER,
// SystemLog::TYPE_LOGIN_FAILURE,
// null,
// Company::first(),
// );
$this->incrementLoginAttempts($request);
return response()
@ -310,7 +302,12 @@ class LoginController extends BaseController
*/
public function refresh(Request $request)
{
$company_token = CompanyToken::where('token', $request->header('X-API-TOKEN'))->first();
$truth = app()->make(TruthSource::class);
if($truth->getCompanyToken())
$company_token = $truth->getCompanyToken();
else
$company_token = CompanyToken::where('token', $request->header('X-API-TOKEN'))->first();
$cu = CompanyUser::query()
->where('user_id', $company_token->user_id);

View File

@ -247,14 +247,11 @@ class User extends Authenticatable implements MustVerifyEmail
}
return $this->token()->cu;
// return $this->company_user();
}
public function company_user()
{
// if (! $this->id && auth()->user()) {
// $this->id = auth()->user()->id;
// }
// return $this->hasOneThrough(CompanyUser::class, CompanyToken::class, 'user_id', 'user_id', 'id', 'user_id')
// ->withTrashed();

View File

@ -16,6 +16,7 @@ use App\Models\Company;
use App\Models\CompanyToken;
use App\Models\CompanyUser;
use App\Models\User;
use App\Utils\TruthSource;
class CompanyUserTransformer extends EntityTransformer
{
@ -79,7 +80,12 @@ class CompanyUserTransformer extends EntityTransformer
public function includeToken(CompanyUser $company_user)
{
$token = $company_user->tokens->where('company_id', $company_user->company_id)->where('user_id', $company_user->user_id)->first();
$truth = app()->make(TruthSource::class);
if($truth->getCompanyToken())
$token = $truth->getCompanyToken();
else
$token = $company_user->tokens->where('company_id', $company_user->company_id)->where('user_id', $company_user->user_id)->first();
$transformer = new CompanyTokenTransformer($this->serializer);

View File

@ -14,8 +14,8 @@ return [
'require_https' => env('REQUIRE_HTTPS', true),
'app_url' => rtrim(env('APP_URL', ''), '/'),
'app_domain' => env('APP_DOMAIN', 'invoicing.co'),
'app_version' => '5.3.67',
'app_tag' => '5.3.67',
'app_version' => '5.3.68',
'app_tag' => '5.3.68',
'minimum_client_version' => '5.0.16',
'terms_version' => '1.0.1',
'api_secret' => env('API_SECRET', ''),