Page 1 of 2

Image selection / manager throws invalid session token

Posted: Tue Sep 12, 2017 7:56 am
by Digibits
*Note: Previously posted in the wrong forum by accident so moving to correct version forum

Setup:
- Fresh install of OC 3.0.2.0
- Development docker container with php 7.0.19
- SSL & SEO URLs are OFF
- On first access to the admin, i was notified to move the storage dir out of the web root, so i selected the automatic option and it completed with success.


ISSUE:
Anywhere in the admin where I am supposed to be able to edit an image say my profile, or image for an product option etc, I get a login modal with the message : Invalid token session. Please login again.
When you login again, you get the content of the image selection modal but refreshed as a page so there is no admin site, css, js etc.. just the content of the modal.

Any Ideas?

Here is the AJAX url that is being called and returns the login modal:

Code: Select all

http://localhost:8087/admin/index.php?route=common/filemanager&token=&target=input-image0&thumb=thumb-image0
Looks like the token is not being passed to the url.. why would that be?

Re: Image selection / manager throws invalid session token

Posted: Tue Sep 26, 2017 11:10 pm
by Iamdbat
I have exactly the same problem

Re: Image selection / manager throws invalid session token

Posted: Thu Sep 28, 2017 6:53 am
by straightlight
Opencart 3.0.2.0 does not contain any defined token key in the URL but rather a new one called: user_token . If this error comes from an AJAX call which a token does not return, there are two possibilities:

1 - You are not using Opencart 3.0.2.0 .
2 - You are using Opencart 3.0.2.0 but using an installed extension using the old defined token key which the file manager controller is no longer defined with.

Either in your installed XML contribution file or from the previous original admin/view/template/common/filemanager.twig file you might have to,

find all instances of:

Code: Select all

&token
replace, each, with:

Code: Select all

&user_token
This should resolved the problem.

Re: Image selection / manager throws invalid session token

Posted: Tue Oct 17, 2017 10:18 pm
by fantastico
I can confirm i get this issue too on a fresh install 3.0.2.0

Thank you straightlight for your suggestion but it did not help as all instances of token in filemanager.twig are user_token already.

Re: Image selection / manager throws invalid session token

Posted: Tue Oct 17, 2017 10:46 pm
by straightlight
Some modifications were done on Github regarding the admin file manager lately at this location:

- Controller: https://github.com/opencart/opencart/bl ... anager.php
- Twig: https://github.com/opencart/opencart/bl ... nager.twig

Download them and upload them each accordingly to your admin folder, clear all caches and see if that resolves the issue.

Re: Image selection / manager throws invalid session token

Posted: Wed Oct 18, 2017 2:42 am
by fantastico
Thank you Straightlight, that worked great.

Only issue i can see is that when trying to add a new folder in the image manager the "Warning: Directory does not exist!" popup comes up and the new folder is not created.

Re: Image selection / manager throws invalid session token

Posted: Wed Oct 18, 2017 3:19 am
by straightlight
This subject has been covered on this topic: https://github.com/opencart/opencart/issues/6108

Re: Image selection / manager throws invalid session token

Posted: Wed Oct 18, 2017 4:44 am
by fantastico
Many thanks Straightlight :)

Re: Image selection / manager throws invalid session token

Posted: Fri Dec 08, 2017 11:33 pm
by wendellrt
Hi. I tried the fix as suggested by 'StraightLight' below. While that has indeed fixed the 'Invalid Sessions' error, now the Image Manager only shows the first page of images so images on the other pages are not accessible.
Anyone have a fix for this?

Thanks.


Some modifications were done on Github regarding the admin file manager lately at this location:

- Controller: https://github.com/opencart/opencart/bl ... anager.php
- Twig: https://github.com/opencart/opencart/bl ... nager.twig

Download them and upload them each accordingly to your admin folder, clear all caches and see if that resolves the issue.
The most generated errors being found on Opencart forum originates from contributed programming.

Regards,
Straightlight

Re: Image selection / manager throws invalid session token

Posted: Fri Dec 08, 2017 11:47 pm
by straightlight
Anyone have a fix for this?
No OC version posted.

Re: Image selection / manager throws invalid session token

Posted: Fri Dec 08, 2017 11:54 pm
by wendellrt
Apologies.
OC version 3.0.2.0 (fresh install).

Re: Image selection / manager throws invalid session token

Posted: Fri Dec 08, 2017 11:56 pm
by straightlight
Have you also applied this solution? https://github.com/opencart/opencart/pu ... 121d8e5774

Re: Image selection / manager throws invalid session token

Posted: Sat Dec 09, 2017 12:06 am
by wendellrt
Yes I have. Please see attached screenshot.
straightlight wrote:
Fri Dec 08, 2017 11:56 pm
Have you also applied this solution? https://github.com/opencart/opencart/pu ... 121d8e5774

Re: Image selection / manager throws invalid session token

Posted: Sat Dec 09, 2017 12:07 am
by straightlight
Did you cleared all caches from your OC admin as well from your browser after making these changes?

Re: Image selection / manager throws invalid session token

Posted: Sat Dec 09, 2017 12:11 am
by wendellrt
straightlight wrote:
Sat Dec 09, 2017 12:07 am
Did you cleared all caches from your OC admin as well from your browser after making these changes?
I cleared the web browser. I don't know how to clear the OC admin.

Re: Image selection / manager throws invalid session token

Posted: Sat Dec 09, 2017 12:14 am
by straightlight
Admin Dashboard - > Blue square icon on the top right - > Clear both cache
Admin - > Extensions - > Modifications - > Refresh Button.

Re: Image selection / manager throws invalid session token

Posted: Sat Dec 09, 2017 12:18 am
by wendellrt
straightlight wrote:
Sat Dec 09, 2017 12:14 am
Admin Dashboard - > Blue square icon on the top right - > Clear both cache
Admin - > Extensions - > Modifications - > Refresh Button.
Did that. Same result.

Re: Image selection / manager throws invalid session token

Posted: Sat Dec 09, 2017 12:23 am
by straightlight
Log out from your Opencart admin account. Clear your browser's cache and close the browser. Then, make a backup of your store. Then, from the Github master files, re-upload the admin/view/javascript folder by replacing the previous files automatically from your host file manager console. Then, set the permissions recursively on the javascript folder to 0755. See if that solves the issue when logging back into the Opencart admin.

Re: Image selection / manager throws invalid session token

Posted: Sat Dec 09, 2017 12:36 am
by wendellrt
straightlight wrote:
Sat Dec 09, 2017 12:23 am
Log out from your Opencart admin account. Clear your browser's cache and close the browser. Then, make a backup of your store. Then, from the Github master files, re-upload the admin/view/javascript folder by replacing the previous files automatically from your host file manager console. Then, set the permissions recursively on the javascript folder to 0755. See if that solves the issue when logging back into the Opencart admin.
Sorry. Did that and issue still there.

Re: Image selection / manager throws invalid session token

Posted: Sat Dec 09, 2017 12:38 am
by straightlight
Install a fresh version of the master files from Github Opencart on your virtual server and / or on a separate folder and see if you can replicate this issue without any extensions installed.