summaryrefslogtreecommitdiff
path: root/actions/twittersettings.php
diff options
context:
space:
mode:
authorZach Copley <zach@controlyourself.ca>2008-08-29 00:57:24 -0400
committerZach Copley <zach@controlyourself.ca>2008-08-29 00:57:24 -0400
commit6c4dc071bffd16c0a1da8382bc6e854841f1b6d1 (patch)
tree5429ba1186bed8d96255d462983582dc87fa32f9 /actions/twittersettings.php
parenta637f36214d0da21f6f51e5763ff77faefaf10a6 (diff)
CSRF protection in twittersettings.php
darcs-hash:20080829045724-7b5ce-66fdc5e54155012e41eb09c6a41bc94619bf520f.gz
Diffstat (limited to 'actions/twittersettings.php')
-rw-r--r--actions/twittersettings.php9
1 files changed, 9 insertions, 0 deletions
diff --git a/actions/twittersettings.php b/actions/twittersettings.php
index 592c9347f..dac0ce200 100644
--- a/actions/twittersettings.php
+++ b/actions/twittersettings.php
@@ -43,6 +43,7 @@ class TwittersettingsAction extends SettingsAction {
'id' => 'twittersettings',
'action' =>
common_local_url('twittersettings')));
+ common_hidden('token', common_session_token());
if ($fuser) {
common_element_start('p');
@@ -83,6 +84,14 @@ class TwittersettingsAction extends SettingsAction {
}
function handle_post() {
+
+ # 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;
+ }
+
if ($this->arg('save')) {
$this->save_preferences();
} else if ($this->arg('add')) {