diff options
author | Evan Prodromou <evan@prodromou.name> | 2008-08-28 22:51:27 -0400 |
---|---|---|
committer | Evan Prodromou <evan@prodromou.name> | 2008-08-28 22:51:27 -0400 |
commit | dd55916d5671f910698499f0786f9a94d95f5977 (patch) | |
tree | a620c87ed216df103646005c5f34a42547a72f6e | |
parent | d3c86d00163bba1a57d1f597995721b8badbce62 (diff) |
CSRF protection in deletenotice
darcs-hash:20080829025127-84dde-b3e2eb64b7dd8302037f471f6dba6949e2e15ecc.gz
-rw-r--r-- | actions/deletenotice.php | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/actions/deletenotice.php b/actions/deletenotice.php index f2c040a5a..af620f036 100644 --- a/actions/deletenotice.php +++ b/actions/deletenotice.php @@ -49,6 +49,7 @@ class DeletenoticeAction extends DeleteAction { common_element_start('form', array('id' => 'notice_delete_form', 'method' => 'post', 'action' => common_local_url('deletenotice'))); + common_hidden('token', common_session_token()); common_hidden('notice', $this->trimmed('notice')); common_element_start('p'); common_element('span', array('id' => 'confirmation_text'), _('Are you sure you want to delete this notice?')); @@ -67,6 +68,12 @@ class DeletenoticeAction extends DeleteAction { } function delete_notice() { + # CSRF protection + $token = $this->trimmed('token'); + if (!$token || $token != common_session_token()) { + $this->show_form(_('There was a problem with your session token. Try again, please.')); + return; + } $url = common_get_returnto(); $confirmed = $this->trimmed('submit'); if ($confirmed == _('Yes')) { |