Jump to content

[SOLVED] redirectAdmin() and wrong token


vukan71

Recommended Posts

I tried using: Tools::redirectAdmin($link); to redirect to the other admin page. Problem is token.

 

on first page I have

?token=5e344f2e07efc53edec490439b0d049a

 

when Tools::redirectAdmin($link) redirects me, I get: Invalid security token.

 

and on the next page

?token=dc6adcb2f5d406e67293704da26da7a5

 

I tied to add:

 

 

$link =' . '?tab=MyTab&token=' . Tools::getAdminToken('Some_Unknow_Value_Here');

$link =' . '?tab=MyTab&token=' . $this->token;

...

 

I think that solution could be here:

 

 

public static function getAdminToken($string)

{

return !empty($string) ? self::encrypt($string) : false;

}

 

in $string. But what should be string?

Edited by vukan71 (see edit history)
Link to comment
Share on other sites

Thanx for answer but I fond solution in presta shop code.

 

if link where I want to redirect is:

 

index.php?tab=MyTabName&token=dc6adcb2f5d406e67293704da26da7a5

 

Solution is not to use Tools::getAdminToken but Tools::getAdminTokenLite:

 

 

Tools::redirectAdmin(

$currentIndex.'index.php?tab=MyTabName&token='.Tools::getAdminTokenLite('MyTabName')

);

 

And now it works perfectly.

 

If you have tab that you want to redirect to, you just call Tools::getAdminTokenLite('MyTabName') and Insert tab name as parametar

Link to comment
Share on other sites

  • 10 months later...
  • 1 year later...
  • 9 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...