mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-08 11:14:31 -04:00
Use custom settings in client portal url
This commit is contained in:
parent
c41d1cd307
commit
f46a7888a8
@ -228,6 +228,11 @@ class ClientPortalController extends BaseController
|
|||||||
|
|
||||||
public function dashboard($contactKey = false)
|
public function dashboard($contactKey = false)
|
||||||
{
|
{
|
||||||
|
if (request()->silent) {
|
||||||
|
session(['silent' => true]);
|
||||||
|
return redirect(request()->url());
|
||||||
|
}
|
||||||
|
|
||||||
if ($contactKey) {
|
if ($contactKey) {
|
||||||
if (! $contact = Contact::where('contact_key', '=', $contactKey)->first()) {
|
if (! $contact = Contact::where('contact_key', '=', $contactKey)->first()) {
|
||||||
return $this->returnError();
|
return $this->returnError();
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Utils;
|
||||||
use Illuminate\Auth\Authenticatable;
|
use Illuminate\Auth\Authenticatable;
|
||||||
use Illuminate\Auth\Passwords\CanResetPassword;
|
use Illuminate\Auth\Passwords\CanResetPassword;
|
||||||
use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
|
use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
|
||||||
@ -142,6 +143,23 @@ class Contact extends EntityModel implements AuthenticatableContract, CanResetPa
|
|||||||
*/
|
*/
|
||||||
public function getLinkAttribute()
|
public function getLinkAttribute()
|
||||||
{
|
{
|
||||||
return \URL::to('client/dashboard/' . $this->contact_key);
|
if (! $this->account) {
|
||||||
|
$this->load('account');
|
||||||
|
}
|
||||||
|
|
||||||
|
$account = $this->account;
|
||||||
|
$url = trim(SITE_URL, '/');
|
||||||
|
|
||||||
|
if ($account->hasFeature(FEATURE_CUSTOM_URL)) {
|
||||||
|
if (Utils::isNinjaProd()) {
|
||||||
|
$url = $account->present()->clientPortalLink();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->account->subdomain) {
|
||||||
|
$url = Utils::replaceSubdomain($url, $account->subdomain);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return "{$url}/client/dashboard/{$this->contact_key}";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -157,7 +157,10 @@
|
|||||||
<i class="fa fa-phone" style="width: 20px"></i>{{ $contact->phone }}<br/>
|
<i class="fa fa-phone" style="width: 20px"></i>{{ $contact->phone }}<br/>
|
||||||
@endif
|
@endif
|
||||||
@if (Auth::user()->confirmed && $client->account->enable_client_portal)
|
@if (Auth::user()->confirmed && $client->account->enable_client_portal)
|
||||||
<i class="fa fa-dashboard" style="width: 20px"></i><a href="{{ $contact->link }}" target="_blank">{{ trans('texts.view_client_portal') }}</a><br/>
|
<i class="fa fa-dashboard" style="width: 20px"></i><a href="{{ $contact->link }}"
|
||||||
|
onclick="window.open('{{ $contact->link }}?silent=true', '_blank');return false;">{{ trans('texts.view_client_portal') }}
|
||||||
|
</a>
|
||||||
|
<br/>
|
||||||
@endif
|
@endif
|
||||||
@endforeach
|
@endforeach
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user