feat(auth): enhance password reset attempt handling with new reasons and update related services
This commit is contained in:
@@ -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');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user