X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=actions%2Fopenidlogin.php;h=b066b9aa4ecdb349381d1e0c4fbd38e7aa7b563b;hb=2e239e3fbb4b8b8bc837f32ee750c9cbf266f246;hp=874ef81b254527197476923f79db7ceb53ef0acd;hpb=87b494f1ebbe7640d194ef322af12fdf378295df;p=quix0rs-gnu-social.git diff --git a/actions/openidlogin.php b/actions/openidlogin.php index 874ef81b25..b066b9aa4e 100644 --- a/actions/openidlogin.php +++ b/actions/openidlogin.php @@ -29,6 +29,14 @@ class OpenidloginAction extends Action { common_user_error(_('Already logged in.')); } else if ($_SERVER['REQUEST_METHOD'] == 'POST') { $openid_url = $this->trimmed('openid_url'); + + # 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.'), $openid_url); + return; + } + $result = oid_authenticate($openid_url, 'finishopenidlogin'); if (is_string($result)) { # error message @@ -62,6 +70,7 @@ class OpenidloginAction extends Action { common_element_start('form', array('method' => 'post', 'id' => 'openidlogin', 'action' => $formaction)); + common_hidden('token', common_session_token()); common_input('openid_url', _('OpenID URL'), $openid_url, _('Your OpenID URL'));