• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
CSRF regenerate with AJAX

#8
(04-15-2020, 12:30 PM)Leo Wrote:
(04-15-2020, 12:09 PM)Naaah, it seems brutal, but its not wasteful with processing time - Javascript is client-side!  I think it can work with a hundred little forms no problem - but I never design sites with too many forms - this is for administration panel, editing and deleting photos. I tried to make it as plug-and-play as possible so I may use it in various sections of the admin panel.What is the problem? After you createvar csrf = $(\.csrf_token').val(); Wrote: <input type="hidden" class="csrf_token" name="csrf_token" value="<?= csrf_hash(); ?>">
            $.ajax({url: '<?= base_url() ?>/NameController/namefunction',
                    type: 'POST',
                    data: { "<?= csrf_token(); ?>": csrf},
                    dataType: "json"
                }).done(function (data) {
                $('.csrf_token').val(data.csrf);
NameController
 namefunction(){
return json_encode(array('result' => 1, 'csrf'=> csrf_hash()));
}
Reply


Messages In This Thread
CSRF regenerate with AJAX - by Leo - 04-14-2020, 03:40 PM
RE: CSRF regenerate with AJAX - by Gary - 04-14-2020, 06:49 PM
RE: CSRF regenerate with AJAX - by Leo - 04-14-2020, 11:34 PM
RE: CSRF regenerate with AJAX - by entis - 04-15-2020, 08:02 AM
RE: CSRF regenerate with AJAX - by Gary - 04-15-2020, 12:09 PM
RE: CSRF regenerate with AJAX - by Leo - 04-15-2020, 12:30 PM
RE: CSRF regenerate with AJAX - by Morgun_Andrey - 05-05-2020, 02:39 PM
RE: CSRF regenerate with AJAX - by Gary - 04-15-2020, 01:17 PM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.