fix(admin): reject customer email on operator account update; do not claim mail delivery on dispatch
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>feat/portal-design
parent
d68d8e1f25
commit
e5c74c6bdd
|
|
@ -129,10 +129,13 @@ class Maintenance extends Component
|
|||
['email' => $customer->email],
|
||||
);
|
||||
if ($delivery->wasRecentlyCreated) {
|
||||
// The ledger row (created here) is the idempotency marker so we
|
||||
// queue at most once per customer. sent_at stays null until the
|
||||
// mail is actually delivered — a MessageSent listener could stamp
|
||||
// it later; we never claim delivery merely on dispatch.
|
||||
Mail::to($customer->email)
|
||||
->locale($customer->locale ?: config('app.locale'))
|
||||
->queue(new MaintenanceAnnouncementMail($window, $customer));
|
||||
$delivery->update(['sent_at' => now()]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,6 +49,15 @@ class Settings extends Component
|
|||
'name' => 'required|string|max:255',
|
||||
'email' => 'required|email|max:255|unique:users,email,'.$user->id,
|
||||
]);
|
||||
|
||||
// An operator email must never collide with a customer's — that would
|
||||
// block the customer from ever obtaining a portal login (ensureUser).
|
||||
if (Customer::query()->where('email', $data['email'])->exists()) {
|
||||
$this->addError('email', __('admin_settings.is_customer'));
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$user->update($data);
|
||||
$this->dispatch('notify', message: __('admin_settings.account_saved'));
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue