simonridley / tracking-code-manager

2 stars 5 forks source link

Opening "Tracking Code Mgr" logs me out of the cp #7

Open generator85 opened 1 year ago

generator85 commented 1 year ago

I just installed this package, but when clicking "Tracking Code Mgr" I get logged out of the control panel.

Also the menu item "Tracking Code Mgr" doesn't have an icon, which doesn't look very good next to all the other menu items.

simonridley commented 1 year ago

@generator85 which version of Statamic are you using?

generator85 commented 1 year ago

The latest version (4.7.0)

benfreke commented 1 year ago

Just commenting here as it may be relevant. The latest version hasn't been published to packagist. But with the changes in that version (which I've attempted to apply manually) I also get logged out of the CP.

simonridley commented 1 year ago

Hi @benfreke and @generator85 I've updated it in Packagist now, so it's showing 1.0.1

generator85 commented 1 year ago

Yes, the issue still exists with v1.0.1

fvanhove commented 1 year ago

From what I can tell the problem lies in the middleware.

The package seems to use the 'web' middleware, this middleware does not pass an authenticated cp user cookie.

Changing the middleware from web to the following solves the issue for me.

Route::middleware('statamic.cp.authenticated')->group(function () {
    Route::get('/simonridley/trackingcodemanager/', '\Simonridley\TrackingCodeManager\Http\Controllers\TrackingCodeManagerController@index')->name('simonridley.tracking-code-manager.index');
    Route::post('/simonridley/trackingcodemanager/', '\Simonridley\TrackingCodeManager\Http\Controllers\TrackingCodeManagerController@update')->name('simonridley.tracking-code-manager.update');
});

Altho this should be altered in the package source files ;-)

generator85 commented 1 year ago

Any updates on this?

jnbn commented 1 year ago

Created a pr for this on https://github.com/simonridley/tracking-code-manager/pull/8

simonridley commented 1 month ago

Would anyone like to become a collaborator as I don't have much time to do this

benfreke commented 1 month ago

HI @simonridley

I'm happy to help collaborate on this. I also don't have too much time but happy to help out with small stuff like this.