From 23e23918b47f35e5b75d95196475638d060f0d33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Beganovi=C4=87?= Date: Tue, 1 Jun 2021 14:06:47 +0200 Subject: [PATCH] Show register link on the login page --- .../Auth/ContactLoginController.php | 13 +++++++-- .../portal/ninja2020/auth/login.blade.php | 28 +++++++++++-------- 2 files changed, 28 insertions(+), 13 deletions(-) diff --git a/app/Http/Controllers/Auth/ContactLoginController.php b/app/Http/Controllers/Auth/ContactLoginController.php index 61e32e1cbcd5..42907659b49a 100644 --- a/app/Http/Controllers/Auth/ContactLoginController.php +++ b/app/Http/Controllers/Auth/ContactLoginController.php @@ -15,6 +15,7 @@ use App\Events\Contact\ContactLoggedIn; use App\Http\Controllers\Controller; use App\Models\Account; use App\Models\ClientContact; +use App\Models\Company; use App\Utils\Ninja; use Auth; use Illuminate\Foundation\Auth\AuthenticatesUsers; @@ -34,11 +35,19 @@ class ContactLoginController extends Controller public function showLoginForm(Request $request) { + if ($request->subdomain) { + $company = Company::where('subdomain', $request->subdomain)->first(); + } elseif (Ninja::isSelfHost()) { + $company = Account::first()->default_company; + } else { + $company = null; + } + $account_id = $request->get('account_id'); $account = Account::find($account_id); - return $this->render('auth.login', ['account' => $account]); - + return $this->render('auth.login', ['account' => $account, 'company' => $company]); + } public function login(Request $request) diff --git a/resources/views/portal/ninja2020/auth/login.blade.php b/resources/views/portal/ninja2020/auth/login.blade.php index c4184c0b9c39..72329438934a 100644 --- a/resources/views/portal/ninja2020/auth/login.blade.php +++ b/resources/views/portal/ninja2020/auth/login.blade.php @@ -9,20 +9,21 @@ @section('body')
@if($account && !$account->isPaid()) - + @endif
- @if($account && !$account->isPaid()) -
- Invoice Ninja logo -
- @endif + @if($account && !$account->isPaid()) +
+ Invoice Ninja logo +
+ @endif

{{ ctrans('texts.client_portal') }}

@@ -61,9 +62,14 @@
+ + @if(!is_null($company) && $company->client_can_register) + + @endif
- @endsection