X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=actions%2Fopenidsettings.php;h=f539d111f9e302abef5daf1f98c6e5b355839879;hb=2abe10b8ea4b5d69fc7f6513bf465541454ca2cf;hp=e77de88b1ae6c5b65a6a01785768063bad24f73b;hpb=87b494f1ebbe7640d194ef322af12fdf378295df;p=quix0rs-gnu-social.git diff --git a/actions/openidsettings.php b/actions/openidsettings.php index e77de88b1a..f539d111f9 100644 --- a/actions/openidsettings.php +++ b/actions/openidsettings.php @@ -40,6 +40,7 @@ class OpenidsettingsAction extends SettingsAction { 'id' => 'openidadd', 'action' => common_local_url('openidsettings'))); + common_hidden('token', common_session_token()); common_element('h2', NULL, _('Add OpenID')); common_element('p', NULL, _('If you want to add an OpenID to your account, ' . @@ -93,6 +94,7 @@ class OpenidsettingsAction extends SettingsAction { 'action' => common_local_url('openidsettings'))); common_element_start('p'); + common_hidden('token', common_session_token()); common_element('a', array('href' => $oid->canonical), $oid->display); common_element('input', array('type' => 'hidden', @@ -115,6 +117,13 @@ class OpenidsettingsAction 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('add')) { $result = oid_authenticate($this->trimmed('openid_url'), 'finishaddopenid'); if (is_string($result)) { # error message