fix(auth): resolve login identities by active email and role

This commit is contained in:
2026-09-04 14:17:19 -03:00
parent e4db36e650
commit 99594b17e7
7 changed files with 28 additions and 8 deletions

View File

@@ -78,6 +78,7 @@ class PasswordLoginService
string $password,
?string $ipAddress,
?string $userAgent,
RoleCode $role = RoleCode::Scanner,
): User {
return $this->authenticateUser(
$email,
@@ -85,10 +86,12 @@ class PasswordLoginService
null,
$ipAddress,
$userAgent,
null,
$role,
true,
PermissionCode::ScanTickets->value,
PasswordResetRequested::CHANNEL_SCANNER,
$role === RoleCode::AdminApp
? PasswordResetRequested::CHANNEL_ADMINAPP
: PasswordResetRequested::CHANNEL_SCANNER,
);
}
@@ -120,7 +123,7 @@ class PasswordLoginService
$passwordResetChannel,
): array {
$user = User::query()
->where('email', $normalizedEmail)
->where('active_email', $normalizedEmail)
->when(
$requiredRole !== null,
fn ($query) => $query->where('rol_codigo', $requiredRole->value),