mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 21:22:58 +01:00
Merge pull request #5661 from turbo124/v5-develop
Disable client portal
This commit is contained in:
commit
3fca12f970
@ -31,4 +31,9 @@ class ContactHashLoginController extends Controller
|
||||
{
|
||||
return redirect('/client/login');
|
||||
}
|
||||
|
||||
public function errorPage()
|
||||
{
|
||||
return render('generic.error', ['title' => session()->get('title'), 'notification' => session()->get('notification')]);
|
||||
}
|
||||
}
|
||||
|
@ -31,15 +31,15 @@ class CheckClientExistence
|
||||
$multiple_contacts = ClientContact::query()
|
||||
->where('email', auth('contact')->user()->email)
|
||||
->whereNotNull('email')
|
||||
->whereNull('deleted_at')
|
||||
->distinct('company_id')
|
||||
->distinct('email')
|
||||
->whereNotNull('company_id')
|
||||
->whereHas('client', function ($query) {
|
||||
return $query->whereNull('deleted_at');
|
||||
})
|
||||
->get();
|
||||
|
||||
nlog($multiple_contacts);
|
||||
|
||||
if (count($multiple_contacts) == 0) {
|
||||
Auth::logout();
|
||||
|
||||
|
@ -26,7 +26,7 @@ class ClientPortalEnabled
|
||||
public function handle($request, Closure $next)
|
||||
{
|
||||
if (auth()->user()->client->getSetting('enable_client_portal') === false) {
|
||||
return redirect()->to('client/dashboard');
|
||||
return redirect()->route('client.error')->with(['title' => ctrans('texts.client_portal'), 'notification' => 'This section of the app has been disabled by the administrator.']);
|
||||
}
|
||||
|
||||
return $next($request);
|
||||
|
@ -43,7 +43,7 @@ class ExpenseDeletedActivity implements ShouldQueue
|
||||
|
||||
$fields = new stdClass;
|
||||
|
||||
$user_id = $event->event_vars['user_id'] ?: $event->expense->user_id;
|
||||
$user_id = array_key_exists('user_id', $event->event_vars['user_id']) ? $event->event_vars['user_id'] : $event->expense->user_id;
|
||||
|
||||
$fields->expense_id = $event->expense->id;
|
||||
$fields->user_id = $user_id;
|
||||
|
@ -43,7 +43,7 @@ class TaskDeletedActivity implements ShouldQueue
|
||||
|
||||
$fields = new stdClass;
|
||||
|
||||
$user_id = $event->event_vars['user_id'] ?: $event->task->user_id;
|
||||
$user_id = array_key_exists('user_id', $event->event_vars) ? $event->event_vars['user_id'] : $event->task->user_id;
|
||||
|
||||
$fields->task_id = $event->task->id;
|
||||
$fields->user_id = $user_id;
|
||||
|
@ -23,7 +23,7 @@
|
||||
<div class="rounded bg-white shadow-xs">
|
||||
<div class="py-1">
|
||||
@foreach($multiple_contacts as $contact)
|
||||
<a data-turbolinks="false" href="{{ route('client.switch_company', $contact->hashed_id) }}" class="block px-4 py-2 text-sm leading-5 text-gray-700 hover:bg-gray-100 hover:text-gray-900 focus:outline-none focus:bg-gray-100 focus:text-gray-900">{{ $contact->company->present()->name }}</a>
|
||||
<a data-turbolinks="false" href="{{ route('client.switch_company', $contact->hashed_id) }}" class="block px-4 py-2 text-sm leading-5 text-gray-700 hover:bg-gray-100 hover:text-gray-900 focus:outline-none focus:bg-gray-100 focus:text-gray-900">{{ $contact->company->present()->name() }} - {{ $contact->client->present()->name()}}</a>
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
|
20
resources/views/portal/ninja2020/generic/error.blade.php
Normal file
20
resources/views/portal/ninja2020/generic/error.blade.php
Normal file
@ -0,0 +1,20 @@
|
||||
@extends('portal.ninja2020.layout.clean')
|
||||
@section('meta_title', ctrans('texts.confirmation'))
|
||||
|
||||
@section('body')
|
||||
|
||||
<div class="flex h-screen">
|
||||
<div class="m-auto md:w-1/3 lg:w-1/5">
|
||||
<div class="flex flex-col items-center">
|
||||
<img src="{{ asset('images/invoiceninja-black-logo-2.png') }}" class="border-b border-gray-100 h-18 pb-4" alt="Invoice Ninja logo">
|
||||
<h1 class="text-center text-3xl mt-10">{{ $title }}</h1>
|
||||
<p class="text-center opacity-75">{{ $notification }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@stop
|
||||
|
||||
@push('footer')
|
||||
|
||||
@endpush
|
@ -24,6 +24,7 @@ Route::get('tmp_pdf/{hash}', 'ClientPortal\TempRouteController@index')->name('tm
|
||||
Route::get('client/key_login/{contact_key}', 'ClientPortal\ContactHashLoginController@login')->name('client.contact_login')->middleware(['contact_key_login']);
|
||||
Route::get('client/magic_link/{magic_link}', 'ClientPortal\ContactHashLoginController@magicLink')->name('client.contact_magic_link')->middleware(['contact_key_login']);
|
||||
Route::get('documents/{document_hash}', 'ClientPortal\DocumentController@publicDownload')->name('documents.public_download');
|
||||
Route::get('error', 'ClientPortal\ContactHashLoginController@errorPage')->name('client.error');
|
||||
|
||||
//todo implement domain DB
|
||||
Route::group(['middleware' => ['auth:contact', 'locale', 'check_client_existence'], 'prefix' => 'client', 'as' => 'client.'], function () {
|
||||
@ -54,7 +55,7 @@ Route::group(['middleware' => ['auth:contact', 'locale', 'check_client_existence
|
||||
Route::get('payment_methods/{payment_method}/verification', 'ClientPortal\PaymentMethodController@verify')->name('payment_methods.verification');
|
||||
Route::post('payment_methods/{payment_method}/verification', 'ClientPortal\PaymentMethodController@processVerification');
|
||||
|
||||
Route::resource('payment_methods', 'ClientPortal\PaymentMethodController')->except(['edit', 'update']); // name = (payment_methods. index / create / show / update / destroy / edit
|
||||
Route::resource('payment_methods', 'ClientPortal\PaymentMethodController')->except(['edit', 'update']);
|
||||
|
||||
Route::match(['GET', 'POST'], 'quotes/approve', 'ClientPortal\QuoteController@bulk')->name('quotes.bulk');
|
||||
Route::get('quotes', 'ClientPortal\QuoteController@index')->name('quotes.index')->middleware('portal_enabled');
|
||||
@ -74,10 +75,9 @@ Route::group(['middleware' => ['auth:contact', 'locale', 'check_client_existence
|
||||
|
||||
Route::get('subscriptions/{recurring_invoice}/plan_switch/{target}', 'ClientPortal\SubscriptionPlanSwitchController@index')->name('subscription.plan_switch');
|
||||
|
||||
Route::resource('subscriptions', 'ClientPortal\SubscriptionController')->only(['index']);
|
||||
Route::resource('subscriptions', 'ClientPortal\SubscriptionController')->middleware('portal_enabled')->only(['index']);
|
||||
|
||||
Route::post('upload', 'ClientPortal\UploadController')->name('upload.store');
|
||||
|
||||
Route::get('logout', 'Auth\ContactLoginController@logout')->name('logout');
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user