1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-09-20 16:31:33 +02:00

Fixes for client authentication to client portal

This commit is contained in:
David Bomba 2021-01-21 10:01:13 +11:00
parent dadfb6d6a7
commit 62bc55cf0b
3 changed files with 7 additions and 11 deletions

View File

@ -49,10 +49,7 @@ class ClientContact extends Authenticatable implements HasLocalePreference
'hashed_id',
];
protected $with = [
// 'client',
// 'company'
];
protected $with = [];
protected $casts = [
'updated_at' => 'timestamp',
@ -87,12 +84,6 @@ class ClientContact extends Authenticatable implements HasLocalePreference
'client_id',
];
/* Changing the username to id allows us to login() a contact that doesn't have an email address set*/
public function username()
{
return 'id';
}
public function getEntityType()
{
return self::class;

View File

@ -58,6 +58,10 @@ class ClientContactRepository extends BaseRepository
$update_contact->client_id = $client->id;
}
/* We need to set NULL email addresses to blank strings to pass authentication*/
if(array_key_exists('email', $contact) && is_null($contact['email']))
$contact['email'] = '';
$update_contact->fill($contact);
if (array_key_exists('password', $contact) && strlen($contact['password']) > 1) {
@ -77,6 +81,7 @@ class ClientContactRepository extends BaseRepository
$new_contact->contact_key = Str::random(40);
$new_contact->is_primary = true;
$new_contact->confirmed = true;
$new_contact->email = ' ';
$new_contact->save();
}
}

View File

@ -5,7 +5,7 @@
@include('email.components.header', ['logo' => $logo])
@endslot
<h1>{{ $title }}</h1>
<p>{{ $title }}</p>
@slot('greeting')
@lang($message)