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', 'hashed_id',
]; ];
protected $with = [ protected $with = [];
// 'client',
// 'company'
];
protected $casts = [ protected $casts = [
'updated_at' => 'timestamp', 'updated_at' => 'timestamp',
@ -87,12 +84,6 @@ class ClientContact extends Authenticatable implements HasLocalePreference
'client_id', '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() public function getEntityType()
{ {
return self::class; return self::class;

View File

@ -58,6 +58,10 @@ class ClientContactRepository extends BaseRepository
$update_contact->client_id = $client->id; $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); $update_contact->fill($contact);
if (array_key_exists('password', $contact) && strlen($contact['password']) > 1) { 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->contact_key = Str::random(40);
$new_contact->is_primary = true; $new_contact->is_primary = true;
$new_contact->confirmed = true; $new_contact->confirmed = true;
$new_contact->email = ' ';
$new_contact->save(); $new_contact->save();
} }
} }

View File

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