CSRF protection in smssettings.php
darcs-hash:20080829035118-7b5ce-57613e88b29617ea422c7f7003e81ef885e3debb.gz
This commit is contained in:
parent
6afb7f576e
commit
6be7cbc5cd
|
@ -35,7 +35,7 @@ class SmssettingsAction extends EmailsettingsAction {
|
||||||
'id' => 'smssettings',
|
'id' => 'smssettings',
|
||||||
'action' =>
|
'action' =>
|
||||||
common_local_url('smssettings')));
|
common_local_url('smssettings')));
|
||||||
|
common_hidden('token', common_session_token());
|
||||||
common_element('h2', NULL, _('Address'));
|
common_element('h2', NULL, _('Address'));
|
||||||
|
|
||||||
if ($user->sms) {
|
if ($user->sms) {
|
||||||
|
@ -117,6 +117,14 @@ class SmssettingsAction extends EmailsettingsAction {
|
||||||
|
|
||||||
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