filamentphp / filament

A collection of beautiful full-stack components for Laravel. The perfect starting point for your next app. Using Livewire, Alpine.js and Tailwind CSS.
https://filamentphp.com
MIT License
16.24k stars 2.58k forks source link

Route [login] not defined. after User information change #11988

Closed IranMine123 closed 3 months ago

IranMine123 commented 3 months ago

Package

filament/filament

Package Version

v3.2.58

Laravel Version

v10.48.4

Livewire Version

v3.4.9

PHP Version

PHP 8.2.12

Problem description

Hello when user change itself's information like password and etc in form, something like Authentication Exception happen. then Filament redirects user to login route. this requires a route have name of "login". well i don't want that. i mean i really dont want to define a route with 'login' name. tried to change the redirect url on Authentication Middleware by creating a custom one and put it in ->authMiddleware() but didn't work.

Expected behavior

redirect user to defined custom url, or make user stay on panel, or the panel's login page, after user changes itself information on panel with forms

Steps to reproduce

Reproduction repository

https://github.com/IranMine123/filament-login-bug

Relevant log output

https://flareapp.io/share/LPdKe2Ym
here is the exception error
github-actions[bot] commented 3 months ago

Hey @IranMine123! We're sorry to hear that you've hit this issue. 💛

However, it looks like you forgot to fill in the reproduction repository URL. Can you edit your original post and then we'll look at your issue?

We need a public GitHub repository which contains a Laravel app with the minimal amount of Filament code to reproduce the problem. Please do not link to your actual project, what we need instead is a minimal reproduction in a fresh project without any unnecessary code. This means it doesn't matter if your real project is private / confidential, since we want a link to a separate, isolated reproduction. That would allow us to download it and review your bug much easier, so it can be fixed quicker. Please make sure to include a database seeder with everything we need to set the app up quickly.

github-actions[bot] commented 3 months ago

Thank you for providing reproduction steps! Reopening the issue now.

danharrin commented 3 months ago

9075, #7725, #7223, #11629, #5226, please look for duplicate issues before posting

This is a Laravel issue with the fact they are hardcoding this route name in the framework. We do not believe there is a solution on the Filament side. You just need to define a redirect route with that name

DishantPal commented 3 months ago

🛠 Trouble with Export/Import Functionality in Laravel Filament Admin Panel: 'Login Route Not Found' Error

I've been tackling the export/import feature, aiming for smooth functionality. However, upon attempting to export or import a CSV, it seems to generate within the notifications. Yet, when I endeavor to download the file, a persistent 'login route not found' error arises.

Screenshot

I've configured separate guards for authentication, catering to both admin and user panels. Additionally, I've ensured that the export/import policy is correctly set to return true within the view function.

Furthermore, I've diligently included Export::polymorphicUserRelationship(); in the app service provider and executed all requisite database changes.

Despite these efforts, I find myself still grappling with the 'login route not found' issue when attempting to access export/import. Any suggestions on resolving this within the Laravel Filament admin panel?

Osub commented 2 months ago

https://flareapp.io/share/RmrBDglm

antal-levente commented 1 month ago

@DishantPal the issue probably appears because the auth guard is different on the export route then the one you are using for your Filament panel.

In my case it was because i used a different auth guard and even though it was correctly configured according to the documentation. Filament ignored the different user provider on the route and still went with the default one. Basically the solution is to change the auth guard on the export route, however those are hardcoded in the Filament files. Which seems to me to be a bug.

A simple workaround could be if you simply overwrite the route in your route file:

use Filament\Actions\Exports\Http\Controllers\DownloadExport;

Route::get('/filament/exports/{export}/download', DownloadExport::class)
    ->name('filament.exports.download')
    ->middleware(['web', 'auth:admin']);