F
Filament13mo ago
Anish

Automatic Logout

I have a strange issue with my first project in V3. I made a basic User resource. When I update myself, say name, I get automatically logged out. But when I update, another user (given myself admin role and set up the policy that admin can update all users), it works as expected.
Thanks in advance for any help.
6 Replies
jals65
jals6513mo ago
Maybe that's normal because your user change. So the middleware detects that the user who is stored in cookies doesn't exists in database. I try now in my panel and the same happened to me. No logout, but it trows me 403 Forbidden
Anish
AnishOP13mo ago
My thoughts also, but that would make updating the user profile very difficult.
jals65
jals6513mo ago
I see that it's when you modify the email
Anish
AnishOP13mo ago
I am having problem when I update the name even.
jals65
jals6513mo ago
So that's not the same that happens to me. If i modify the name, it works
Anish
AnishOP13mo ago
OK. Thanks for the inputs. I will check what mistakes I am doing. I did a little bit more digging. Now I think it is a laravel thing. I believe that when User model is being saved, the eloquent event that is being generated, is listened by some listener and if name or email is being updated, the session is being regenerated, invalidating the previous login. In EditUser.php, I changed the handleRecordUpdate and made the update by doing the method saveQuietly. This suppresses the event and it does not log me out. I have not yet found the listener yet, I will have to dig some more.
Want results from more Discord servers?
Add your server