if ($this->f3->VERB==='POST')
{
if( $this->f3->get('POST.session_csrf') == $this->f3->get('SESSION.csrf') )
{ // Things check out! No CSRF attack was detected.
$this->f3->set('CSRF', $this->f3->session->csrf()); // Reset csrf token for next post request
$this->f3->copy('CSRF','SESSION.csrf'); // copy token to session
}
else{
echo "DANGER! CSRF ATTACK";
die;
}
}
--
-- You've received this message because you are subscribed to the Google Groups group. To post to this group, send an email to f3-fra...@googlegroups.com. To unsubscribe from this group, send an email to f3-framework...@googlegroups.com. For more options, visit this group at https://groups.google.com/d/forum/f3-framework?hl=en
---
You received this message because you are subscribed to the Google Groups "Fat-Free Framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to f3-framework...@googlegroups.com.
To post to this group, send email to f3-fra...@googlegroups.com.
Visit this group at https://groups.google.com/group/f3-framework.
To view this discussion on the web visit https://groups.google.com/d/msgid/f3-framework/f83778f5-cc78-4a7d-85f1-f532675940b8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
$(document).ready(function() {
$('form').submit(function(event) {
var formData = $( "form" ).serialize();
$.ajax({
type : 'POST',
url : '/process',
data : formData,
dataType : 'text',
encode : true
})
.done(function(data) {
$('#form').html(data);
$('#q_answer').focus();
})
.fail(function(jqXHR, textStatus, errorThrown) {
alert( JSON.stringify(jqXHR) + ': ' + errorThrown);
})
event.preventDefault();
});
});
When do you generate the csrf token? If you are setting it up in a html form (not Ajax) and not getting a new csrf token in Your Ajax call it’s not going to change. Do you do anything to update the csrf field when you update the form via Ajax?