add csrf protection to profile settings
darcs-hash:20080829043909-84dde-c70a633c93ab89560bc300817bda66eebf6176cf.gz
This commit is contained in:
parent
9a65f45c45
commit
6afb7f576e
@ -37,6 +37,7 @@ class ProfilesettingsAction extends SettingsAction {
|
|||||||
'id' => 'profilesettings',
|
'id' => 'profilesettings',
|
||||||
'action' =>
|
'action' =>
|
||||||
common_local_url('profilesettings')));
|
common_local_url('profilesettings')));
|
||||||
|
common_hidden('token', common_session_token());
|
||||||
# too much common patterns here... abstractable?
|
# too much common patterns here... abstractable?
|
||||||
common_input('nickname', _('Nickname'),
|
common_input('nickname', _('Nickname'),
|
||||||
($this->arg('nickname')) ? $this->arg('nickname') : $profile->nickname,
|
($this->arg('nickname')) ? $this->arg('nickname') : $profile->nickname,
|
||||||
@ -80,6 +81,14 @@ class ProfilesettingsAction extends SettingsAction {
|
|||||||
$language = $this->trimmed('language');
|
$language = $this->trimmed('language');
|
||||||
$timezone = $this->trimmed('timezone');
|
$timezone = $this->trimmed('timezone');
|
||||||
|
|
||||||
|
# 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;
|
||||||
|
}
|
||||||
|
|
||||||
# Some validation
|
# Some validation
|
||||||
|
|
||||||
if (!Validate::string($nickname, array('min_length' => 1,
|
if (!Validate::string($nickname, array('min_length' => 1,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user