Skip to content

Commit 5fa88d4

Browse files
committed
fix: lastLogin() does not return login data that logged in by username/password
1 parent 2f6bb67 commit 5fa88d4

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/Models/LoginModel.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,12 @@ public function lastLogin(User $user, bool $allowFailed = false): ?Login
6666
if (! $allowFailed) {
6767
$this->where('success', 1)
6868
->where('user_id', $user->id);
69+
} else {
70+
$this->where('identifier', $user->email)
71+
->orWhere('identifier', $user->username);
6972
}
7073

71-
return $this
72-
->where('identifier', $user->email)
73-
->orderBy('date', 'desc')
74-
->first();
74+
return $this->orderBy('date', 'desc')->first();
7575
}
7676

7777
/**

0 commit comments

Comments
 (0)