Skip to content

Commit

Permalink
Update LoginAttempt.php
Browse files Browse the repository at this point in the history
  • Loading branch information
mikebronner committed May 21, 2024
1 parent b3b52c1 commit e04b4e5
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/Listeners/LoginAttempt.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,17 @@ class LoginAttempt
public function handle(Attempting $event)
{
if (config("services.mixpanel.enable-default-tracking")) {
$email = $event->credentials['email'] ?? $event['email'] ?? '';

$email = data_get($event, "credentials.email")
?: data_get($event, "email")
?: "";
$user = null;
$authModel = config('auth.providers.users.model', config('auth.model'));
$user = app($authModel)
->where('email', $email)
->first();

if ($email) {
$user = app($authModel)
->where('email', $email)
->first();
}

event(new Mixpanel($user, ['Login Attempted' => []]));
}
Expand Down

0 comments on commit e04b4e5

Please sign in to comment.