mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 05:02:36 +01:00
fixes
This commit is contained in:
commit
658f82c171
@ -13,6 +13,7 @@ namespace App\Http\Controllers\Auth;
|
||||
|
||||
use App\Events\Contact\ContactLoggedIn;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\ViewComposers\PortalComposer;
|
||||
use App\Libraries\MultiDB;
|
||||
use App\Models\Account;
|
||||
use App\Models\ClientContact;
|
||||
@ -20,10 +21,10 @@ use App\Models\Company;
|
||||
use App\Utils\Ninja;
|
||||
use Auth;
|
||||
use Illuminate\Foundation\Auth\AuthenticatesUsers;
|
||||
use Illuminate\Http\Request;
|
||||
use Route;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Route;
|
||||
|
||||
class ContactLoginController extends Controller
|
||||
{
|
||||
@ -131,6 +132,8 @@ class ContactLoginController extends Controller
|
||||
return $response;
|
||||
}
|
||||
|
||||
$this->setRedirectPath();
|
||||
|
||||
return $request->wantsJson()
|
||||
? new JsonResponse([], 204)
|
||||
: redirect()->intended($this->redirectPath());
|
||||
@ -156,4 +159,22 @@ class ContactLoginController extends Controller
|
||||
|
||||
return redirect('/client/login');
|
||||
}
|
||||
|
||||
private function setRedirectPath()
|
||||
{
|
||||
|
||||
if(auth()->guard('contact')->user()->company->enabled_modules & PortalComposer::MODULE_INVOICES)
|
||||
$this->redirectTo = '/client/invoices';
|
||||
elseif(auth()->guard('contact')->user()->company->enabled_modules & PortalComposer::MODULE_RECURRING_INVOICES)
|
||||
$this->redirectTo = '/client/recurring_invoices';
|
||||
elseif(auth()->guard('contact')->user()->company->enabled_modules & PortalComposer::MODULE_QUOTES)
|
||||
$this->redirectTo = '/client/quotes';
|
||||
elseif(auth()->guard('contact')->user()->company->enabled_modules & PortalComposer::MODULE_CREDITS)
|
||||
$this->redirectTo = '/client/credits';
|
||||
elseif(auth()->guard('contact')->user()->company->enabled_modules & PortalComposer::MODULE_TASKS)
|
||||
$this->redirectTo = '/client/tasks';
|
||||
elseif(auth()->guard('contact')->user()->company->enabled_modules & PortalComposer::MODULE_EXPENSES)
|
||||
$this->redirectTo = '/client/expenses';
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -12,6 +12,7 @@
|
||||
namespace App\Http\Controllers\ClientPortal;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\ViewComposers\PortalComposer;
|
||||
use App\Models\RecurringInvoice;
|
||||
use Auth;
|
||||
|
||||
@ -36,16 +37,36 @@ class ContactHashLoginController extends Controller
|
||||
|
||||
}
|
||||
|
||||
return redirect('/client/invoices');
|
||||
return redirect($this->setRedirectPath());
|
||||
}
|
||||
|
||||
public function magicLink(string $magic_link)
|
||||
{
|
||||
return redirect('/client/invoices');
|
||||
|
||||
return redirect($this->setRedirectPath());
|
||||
}
|
||||
|
||||
public function errorPage()
|
||||
{
|
||||
return render('generic.error', ['title' => session()->get('title'), 'notification' => session()->get('notification')]);
|
||||
}
|
||||
|
||||
private function setRedirectPath()
|
||||
{
|
||||
|
||||
if(auth()->guard('contact')->user()->company->enabled_modules & PortalComposer::MODULE_INVOICES)
|
||||
return '/client/invoices';
|
||||
elseif(auth()->guard('contact')->user()->company->enabled_modules & PortalComposer::MODULE_RECURRING_INVOICES)
|
||||
return '/client/recurring_invoices';
|
||||
elseif(auth()->guard('contact')->user()->company->enabled_modules & PortalComposer::MODULE_QUOTES)
|
||||
return '/client/quotes';
|
||||
elseif(auth()->guard('contact')->user()->company->enabled_modules & PortalComposer::MODULE_CREDITS)
|
||||
return '/client/credits';
|
||||
elseif(auth()->guard('contact')->user()->company->enabled_modules & PortalComposer::MODULE_TASKS)
|
||||
return '/client/tasks';
|
||||
elseif(auth()->guard('contact')->user()->company->enabled_modules & PortalComposer::MODULE_EXPENSES)
|
||||
return '/client/expenses';
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -11,6 +11,7 @@
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use App\Http\ViewComposers\PortalComposer;
|
||||
use App\Libraries\MultiDB;
|
||||
use App\Models\Client;
|
||||
use App\Models\ClientContact;
|
||||
@ -59,7 +60,7 @@ class ContactKeyLogin
|
||||
return redirect()->to($request->query('redirect'));
|
||||
}
|
||||
|
||||
return redirect()->to('client/dashboard');
|
||||
return redirect($this->setRedirectPath());
|
||||
}
|
||||
}
|
||||
elseif ($request->segment(3) && config('ninja.db.multi_db_enabled')) {
|
||||
@ -77,8 +78,8 @@ class ContactKeyLogin
|
||||
return redirect()->to($request->query('next'));
|
||||
}
|
||||
|
||||
return redirect()->to('client/dashboard');
|
||||
}
|
||||
return redirect($this->setRedirectPath());
|
||||
}
|
||||
|
||||
}
|
||||
} elseif ($request->segment(2) && $request->segment(2) == 'key_login' && $request->segment(3)) {
|
||||
@ -93,7 +94,7 @@ class ContactKeyLogin
|
||||
return redirect($request->query('next'));
|
||||
}
|
||||
|
||||
return redirect()->to('client/dashboard');
|
||||
return redirect($this->setRedirectPath());
|
||||
}
|
||||
} elseif ($request->has('client_hash') && config('ninja.db.multi_db_enabled')) {
|
||||
if (MultiDB::findAndSetDbByClientHash($request->input('client_hash'))) {
|
||||
@ -106,7 +107,7 @@ class ContactKeyLogin
|
||||
$primary_contact->email = Str::random(6) . "@example.com"; $primary_contact->save();
|
||||
|
||||
auth()->guard('contact')->loginUsingId($primary_contact->id, true);
|
||||
return redirect()->to('client/dashboard');
|
||||
return redirect($this->setRedirectPath());
|
||||
}
|
||||
}
|
||||
} elseif ($request->has('client_hash')) {
|
||||
@ -119,10 +120,28 @@ class ContactKeyLogin
|
||||
|
||||
auth()->guard('contact')->loginUsingId($primary_contact->id, true);
|
||||
|
||||
return redirect()->to('client/dashboard');
|
||||
return redirect($this->setRedirectPath());
|
||||
}
|
||||
}
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
|
||||
private function setRedirectPath()
|
||||
{
|
||||
|
||||
if(auth()->guard('contact')->user()->company->enabled_modules & PortalComposer::MODULE_INVOICES)
|
||||
return '/client/invoices';
|
||||
elseif(auth()->guard('contact')->user()->company->enabled_modules & PortalComposer::MODULE_RECURRING_INVOICES)
|
||||
return '/client/recurring_invoices';
|
||||
elseif(auth()->guard('contact')->user()->company->enabled_modules & PortalComposer::MODULE_QUOTES)
|
||||
return '/client/quotes';
|
||||
elseif(auth()->guard('contact')->user()->company->enabled_modules & PortalComposer::MODULE_CREDITS)
|
||||
return '/client/credits';
|
||||
elseif(auth()->guard('contact')->user()->company->enabled_modules & PortalComposer::MODULE_TASKS)
|
||||
return '/client/tasks';
|
||||
elseif(auth()->guard('contact')->user()->company->enabled_modules & PortalComposer::MODULE_EXPENSES)
|
||||
return '/client/expenses';
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -70,16 +70,16 @@ class PaymentMethod
|
||||
|
||||
$transformed_ids = $this->transformKeys(explode(',', $company_gateways));
|
||||
|
||||
$this->gateways =
|
||||
CompanyGateway::with('gateway')
|
||||
->where('company_id', $this->client->company_id)
|
||||
$this->gateways = $this->client
|
||||
->company
|
||||
->company_gateways
|
||||
->whereIn('id', $transformed_ids)
|
||||
->where('is_deleted', false)
|
||||
->whereNull('deleted_at')
|
||||
->where('gateway_key', '!=', '54faab2ab6e3223dbe848b1686490baa')
|
||||
->sortby(function ($model) use ($transformed_ids) { //company gateways are sorted in order of priority
|
||||
return array_search($model->id, $transformed_ids);// this closure sorts for us
|
||||
})->get();
|
||||
});
|
||||
|
||||
} else {
|
||||
|
||||
@ -105,15 +105,16 @@ class PaymentMethod
|
||||
|
||||
$transformed_ids = $this->transformKeys(explode(',', $company_gateways));
|
||||
|
||||
$this->gateways = CompanyGateway::with('gateway')
|
||||
->where('company_id', $this->client->company_id)
|
||||
$this->gateways = $this->client
|
||||
->company
|
||||
->company_gateways
|
||||
->whereIn('id', $transformed_ids)
|
||||
->where('is_deleted', false)
|
||||
->whereNull('deleted_at')
|
||||
->where('gateway_key', '54faab2ab6e3223dbe848b1686490baa')
|
||||
->sortby(function ($model) use ($transformed_ids) { //company gateways are sorted in order of priority
|
||||
return array_search($model->id, $transformed_ids);// this closure sorts for us
|
||||
})->get();
|
||||
});
|
||||
|
||||
} else {
|
||||
|
||||
|
@ -264,7 +264,6 @@ class Helpers
|
||||
|
||||
return $value;
|
||||
// $x = str_replace(["\n", "<br>"], ["\r", "<br>"], $value);
|
||||
|
||||
// return $x;
|
||||
}
|
||||
|
||||
|
@ -78,7 +78,7 @@
|
||||
{{ ctrans('texts.due_date') }}
|
||||
</dt>
|
||||
<dd class="mt-1 text-sm leading-5 text-gray-900 sm:mt-0 sm:col-span-2">
|
||||
{{ $invoice->due_date }}
|
||||
{{ $invoice->translateDate($invoice->due_date, $invoice->client->date_format(), $invoice->client->locale()) }}
|
||||
</dd>
|
||||
</div>
|
||||
@endif
|
||||
|
@ -11,3 +11,9 @@
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
|
||||
Dropzone.prototype.defaultOptions.dictDefaultMessage = '{!! ctrans('texts.dropzone_default_message') !!}';
|
||||
|
||||
</script>
|
Loading…
Reference in New Issue
Block a user