php - Adding CSRF anti-spoofing to Sencha forms -
i made sencha frontend app , backend done php/joomla. data sent sencha js app validated , saved using php joomla framework.
how can create csrf token in sencha js app , validate on php/joomla code
joomla forms protected token checked on every new post. token hidden field insert form
echo jhtml::_('form.token');
this checked in controller
jsession::checktoken('post') or jexit(jtext::_('jinvalid_token'));
this works fine standard get/post interaction. if you're going ajax, need way retrieve new token after each request made:
you controller have return
jsession::getformtoken()
to frontend, should include in next call.
beware: make sure ajax responses not cached: while hidden token input inserted first code snippet handled page cache, must take care of updating other occurrence.
Comments
Post a Comment