Jump to content

Data validation issue with Tokan


Recommended Posts

Hello everyone,

 

I am facing Data validation related issues with my module.

Let me explain my problem :

 

I submitted my module and they said all ajax/cron must be validated with tokan. My problem is I have a link in admin config layout. when I click that link I run ajax and redirect it to ajax.php on root of my module. My question is how do I pass security_key or tokan to ajax file. Jquery click event fire when I click on that link. I used :

$("#linkID").click(function(e) {

 

and inside ajax call run.

 

ajax call url :

url: '../modules/mymodule/ajax.php?token=xxxx',

 

I checked in ajax.php file like :

if (Tools::getValue('token') != 'xxxx'
    || !Module::isInstalled('mymodule')) {
    die('Bad token');
}
 

 

I don't know if it is correct and Prestashop technical team reject this.

 

Please help if someone experienced this issue with module development.

 

Thanks!

Link to comment
Share on other sites

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...