1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 05:02:36 +01:00

fixes for client portal links from client entity

This commit is contained in:
David Bomba 2022-10-09 16:42:31 +11:00
parent c5020c3d29
commit b34a665c24

View File

@ -17,6 +17,7 @@ use App\Jobs\Mail\NinjaMailerObject;
use App\Mail\ClientContact\ClientContactResetPasswordObject;
use App\Models\Presenters\ClientContactPresenter;
use App\Notifications\ClientContactResetPassword;
use App\Utils\Ninja;
use App\Utils\Traits\MakesHash;
use Illuminate\Contracts\Translation\HasLocalePreference;
use Illuminate\Database\Eloquent\Factories\HasFactory;
@ -257,8 +258,33 @@ class ClientContact extends Authenticatable implements HasLocalePreference
*/
public function getLoginLink()
{
$domain = isset($this->company->portal_domain) ? $this->company->portal_domain : $this->company->domain();
// $domain = isset($this->company->portal_domain) ? $this->company->portal_domain : $this->company->domain();
// return $domain.'/client/key_login/'.$this->contact_key;
if (Ninja::isHosted()) {
$domain = $this->company->domain();
} else {
$domain = config('ninja.app_url');
}
switch ($this->company->portal_mode) {
case 'subdomain':
return $domain.'/client/key_login/'.$this->contact_key;
break;
case 'iframe':
return $domain.'/client/key_login/'.$this->contact_key;
//return $domain . $entity_type .'/'. $this->contact->client->client_hash .'/'. $this->key;
break;
case 'domain':
return $domain.'/client/key_login/'.$this->contact_key;
break;
default:
return '';
break;
}
return $domain.'/client/key_login/'.$this->contact_key;
}
}