diff options
author | Zach Copley <zach@controlyourself.ca> | 2008-08-28 23:51:18 -0400 |
---|---|---|
committer | Zach Copley <zach@controlyourself.ca> | 2008-08-28 23:51:18 -0400 |
commit | 6be7cbc5cd4f08dbd86a056f1e7f31ab565237bd (patch) | |
tree | f264a3d129e9321cfc3a0467dbde1fcfe9985a7a | |
parent | 6afb7f576e013ea597686ac3aabe471f2dc70cd1 (diff) |
CSRF protection in smssettings.php
darcs-hash:20080829035118-7b5ce-57613e88b29617ea422c7f7003e81ef885e3debb.gz
-rw-r--r-- | actions/smssettings.php | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/actions/smssettings.php b/actions/smssettings.php index 844fb6160..5db26730a 100644 --- a/actions/smssettings.php +++ b/actions/smssettings.php @@ -35,7 +35,7 @@ class SmssettingsAction extends EmailsettingsAction { 'id' => 'smssettings', 'action' => common_local_url('smssettings'))); - + common_hidden('token', common_session_token()); common_element('h2', NULL, _('Address')); if ($user->sms) { @@ -117,6 +117,14 @@ class SmssettingsAction extends EmailsettingsAction { 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')) { |