You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/known-issues.md
+3-2Lines changed: 3 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,10 +3,11 @@ title: Known Issues
3
3
weight: 2
4
4
---
5
5
6
-
Curable:
6
+
Fixed:
7
7
8
8
-[This cache store is not supported. - torann/geoip](https://github.com/Torann/laravel-geoip/issues/147#issuecomment-528414630)
9
+
- When the session renews Laravel fires the Login event which results in a new login row [1](https://github.com/rappasoft/laravel-authentication-log/issues/13)[2](https://rappasoft.com/docs/laravel-authentication-log/v1/start/configuration#user-content-example-event-override)
9
10
10
11
Unsolved:
11
12
12
-
-[When the session renews Laravel fires the Login event which results in a new login row](https://github.com/rappasoft/laravel-authentication-log/issues/13)
@@ -84,3 +92,88 @@ class User extends Authenticatable
84
92
```
85
93
86
94
The package will listen for Laravel's Login, Logout, Failed, and OtherDeviceLogout events.
95
+
96
+
## Overriding default Laravel events
97
+
98
+
If you would like to listen to your own events you may override them in the package config (as of v1.3).
99
+
100
+
### Example event override
101
+
102
+
You may notice that Laravel [fires a Login event when the session renews](https://github.com/laravel/framework/blob/master/src/Illuminate/Auth/SessionGuard.php#L149) if the user clicked 'remember me' when logging in. This will produce empty login rows each time which is not what we want. The way around this is to fire your own `Login` event instead of listening for Laravels.
103
+
104
+
You can create a Login event that takes the user:
105
+
106
+
```php
107
+
<?php
108
+
109
+
namespace App\Domains\Auth\Events;
110
+
111
+
use Illuminate\Queue\SerializesModels;
112
+
113
+
class Login
114
+
{
115
+
use SerializesModels;
116
+
117
+
public $user;
118
+
119
+
public function __construct($user)
120
+
{
121
+
$this->user = $user;
122
+
}
123
+
}
124
+
```
125
+
126
+
Then override it in the package config:
127
+
128
+
```php
129
+
// The events the package listens for to log
130
+
'events' => [
131
+
'login' => \App\Domains\Auth\Events\Login::class,
132
+
...
133
+
],
134
+
```
135
+
136
+
Then call it where you login your user:
137
+
138
+
```php
139
+
event(new Login($user));
140
+
```
141
+
142
+
Now the package will only register actual login events, and not session re-authentications.
143
+
144
+
### Overriding in Fortify
145
+
146
+
If you are working with Fortify and would like to register your own Login event, you can append a class to the authentication stack:
147
+
148
+
In FortifyServiceProvider:
149
+
150
+
```php
151
+
Fortify::authenticateThrough(function () {
152
+
return array_filter([
153
+
...
154
+
FireLoginEvent::class,
155
+
]);
156
+
});
157
+
```
158
+
159
+
`FireLoginEvent` is just a class that fires the event:
"A failed login to your account": "Échec de la connexion à votre compte",
3
+
"Account": "Compte",
4
+
"Browser": "Navigateur",
5
+
"Hello": "Bonjour",
6
+
"If this was you, you can ignore this alert. If you suspect any suspicious activity on your account, please change your password.": "Si c’était vous, vous pouvez ignorer cette alerte. Si vous soupçonnez une activité suspecte sur votre compte, veuillez modifier votre mot de passe.",
7
+
"IP Address": "Adresse IP",
8
+
"Location": "Emplacement",
9
+
"Regards": "Cordialement",
10
+
"There has been a failed login attempt to your :app account.": "Une tentative de connexion à votre compte sur :app a échoué.",
11
+
"Time": "Heure",
12
+
"Unknown City": "Ville inconnue",
13
+
"Unknown State": "État inconnu",
14
+
"Your :app account logged in from a new device.": "Connexion à votre compte sur :app depuis un nouvel appareil."
0 commit comments