KABBOUCHI/nova-impersonate

Exception "Route [login] not defined." on leaving impersonation - possible error in default configuration file

Etmolf opened this issue · 2 comments

Hey :)

I've just tried the package and stumbled upon a small error that confused me a bit at first.

If using the default configuration provided with the nova package and impersonate any user, then leave the impersonation, an exception is thrown:

"Route [login] not defined."

After publishing the config file i noticed that the following configuration is set per default:

/*
 * Middleware used for nova-impersonate routes
 */
'middleware'        => [
    /*
     * Middleware used for nova-impersonate routes
     */
    'base'  => 'web',
    /*
     * Extra middleware used for leave route
     */
    'leave' => 'auth', // <= important part
],

As the default nova auth guard is named "nova", the "auth" guard doesn't know about any sessions and trys to redirect to the login (which may not be defined in an "nova only environment")

Changing 'leave' => 'auth' to 'leave' => 'nova' solves the problem.

You may consider to change the default value to "nova" - or do i miss something else?

And many thanks for the package :)

by default nova guard is null, did u change ur nova guard option?

https://github.com/laravel/nova/blob/375af45813382079f961f945975124e65d433e8a/config/nova.php#L49-L60

can u reproduce the bug on a new prj? and can u upload it to github?

oh crap: D now i feel dumb .. i totally forgot that i've changed the guard to "nova" - iam so sorry

if i don't set any custom guard in the config/nova.php and use the default configuration of nova-impersonate - everything works fine. my bad

thanks again and keep it up :)