CSRF protection in twittersettings.php
darcs-hash:20080829045724-7b5ce-66fdc5e54155012e41eb09c6a41bc94619bf520f.gz
This commit is contained in:
parent
a637f36214
commit
6c4dc071bf
|
@ -43,6 +43,7 @@ class TwittersettingsAction extends SettingsAction {
|
||||||
'id' => 'twittersettings',
|
'id' => 'twittersettings',
|
||||||
'action' =>
|
'action' =>
|
||||||
common_local_url('twittersettings')));
|
common_local_url('twittersettings')));
|
||||||
|
common_hidden('token', common_session_token());
|
||||||
|
|
||||||
if ($fuser) {
|
if ($fuser) {
|
||||||
common_element_start('p');
|
common_element_start('p');
|
||||||
|
@ -83,6 +84,14 @@ class TwittersettingsAction extends SettingsAction {
|
||||||
}
|
}
|
||||||
|
|
||||||
function handle_post() {
|
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')) {
|
if ($this->arg('save')) {
|
||||||
$this->save_preferences();
|
$this->save_preferences();
|
||||||
} else if ($this->arg('add')) {
|
} else if ($this->arg('add')) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user