feat(auth): enhance password reset attempt handling with new reasons and update related services

This commit is contained in:
2026-08-13 16:49:19 -03:00
parent 630b49cad7
commit a4a4c9afbc
9 changed files with 149 additions and 23 deletions

View File

@@ -2,7 +2,9 @@
namespace App\Domains\Staff\Services;
use App\Domains\Auth\Models\ResetPasswordAttempt;
use App\Domains\Auth\Models\User;
use App\Domains\Auth\Services\ResetPasswordAttemptService;
use App\Domains\Authorization\Enums\RoleCode;
use App\Domains\Catalog\Models\Category;
use App\Domains\Tenant\Models\Tenant;
@@ -15,6 +17,10 @@ use Illuminate\Validation\ValidationException;
class StaffService
{
public function __construct(
private readonly ResetPasswordAttemptService $resetPasswordAttemptService,
) {}
/** @return Collection<int, User> */
public function list(Tenant $tenant, ?string $search = null): Collection
{
@@ -60,6 +66,10 @@ class StaffService
'tenant_codigo' => $tenant->codigo,
]);
$staff->scanCategories()->sync($categoryIds);
$this->resetPasswordAttemptService->createForScannerEmail(
$staff->email,
ResetPasswordAttempt::REASON_STAFF_CREATED,
);
return $staff->load('role', 'scanCategories');
});