function handle($args) { parent::handle($args); if (common_is_real_login()) { $this->clientError(_('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->showForm(_('There was a problem with your session token. Try again, please.'), $openid_url); return; } $rememberme = $this->boolean('rememberme'); common_ensure_session(); $_SESSION['openid_rememberme'] = $rememberme; $result = oid_authenticate($openid_url, 'finishopenidlogin'); if (is_string($result)) { # error message unset($_SESSION['openid_rememberme']); $this->showForm($result, $openid_url); } } else { $openid_url = oid_get_last(); $this->showForm(null, $openid_url); } } }
function handle($args) { parent::handle($args); if (common_is_real_login()) { // TRANS: Client error message trying to log on with OpenID while already logged on. $this->clientError(_m('Already logged in.')); } else { if ($_SERVER['REQUEST_METHOD'] == 'POST') { $provider = common_config('openid', 'trusted_provider'); if ($provider) { $openid_url = $provider; if (common_config('openid', 'append_username')) { $openid_url .= $this->trimmed('openid_username'); } } else { $openid_url = $this->trimmed('openid_url'); } oid_assert_allowed($openid_url); $rememberme = $this->boolean('rememberme'); common_ensure_session(); $_SESSION['openid_rememberme'] = $rememberme; $result = oid_authenticate($openid_url, 'finishopenidlogin'); if (is_string($result)) { # error message unset($_SESSION['openid_rememberme']); $this->showForm($result, $openid_url); } } else { $openid_url = oid_get_last(); $this->showForm(null, $openid_url); } } }
function handle($args) { parent::handle($args); if (common_is_real_login()) { // TRANS: Client error message trying to log on with OpenID while already logged on. $this->clientError(_m('Already logged in.')); } else { if ($_SERVER['REQUEST_METHOD'] == 'POST') { $provider = common_config('openid', 'trusted_provider'); if ($provider) { $openid_url = $provider; if (common_config('openid', 'append_username')) { $openid_url .= $this->trimmed('openid_username'); } } else { $openid_url = $this->trimmed('openid_url'); } oid_assert_allowed($openid_url); # CSRF protection $token = $this->trimmed('token'); if (!$token || $token != common_session_token()) { // TRANS: Message given when there is a problem with the user's session token. $this->showForm(_m('There was a problem with your session token. Try again, please.'), $openid_url); return; } $rememberme = $this->boolean('rememberme'); common_ensure_session(); $_SESSION['openid_rememberme'] = $rememberme; $result = oid_authenticate($openid_url, 'finishopenidlogin'); if (is_string($result)) { # error message unset($_SESSION['openid_rememberme']); $this->showForm($result, $openid_url); } } else { $openid_url = oid_get_last(); $this->showForm(null, $openid_url); } } }
/** * Handle a POST request * * Muxes to different sub-functions based on which button was pushed * * @return void */ function handlePost() { // CSRF protection $token = $this->trimmed('token'); if (!$token || $token != common_session_token()) { // TRANS: Client error displayed when the session token does not match or is not given. $this->showForm(_m('There was a problem with your session token. ' . 'Try again, please.')); return; } if ($this->arg('add')) { if (common_config('openid', 'trusted_provider')) { // TRANS: Form validation error if no OpenID providers can be added. $this->showForm(_m('Cannot add new providers.')); } else { $result = oid_authenticate($this->trimmed('openid_url'), 'finishaddopenid'); if (is_string($result)) { // error message $this->showForm($result); } } } else { if ($this->arg('remove')) { $this->removeOpenid(); } else { if ($this->arg('remove_trustroots')) { $this->removeTrustroots(); } else { // TRANS: Unexpected form validation error. $this->showForm(_m('Something weird happened.')); } } } }
/** * Handle a POST request * * Muxes to different sub-functions based on which button was pushed * * @return void */ function handlePost() { // CSRF protection $token = $this->trimmed('token'); if (!$token || $token != common_session_token()) { $this->showForm(_m('There was a problem with your session token. ' . 'Try again, please.')); return; } if ($this->arg('add')) { if (common_config('openid', 'trusted_provider')) { $this->showForm(_m("Can't add new providers.")); } else { $result = oid_authenticate($this->trimmed('openid_url'), 'finishaddopenid'); if (is_string($result)) { // error message $this->showForm($result); } } } else { if ($this->arg('remove')) { $this->removeOpenid(); } else { if ($this->arg('remove_trustroots')) { $this->removeTrustroots(); } else { $this->showForm(_m('Something weird happened.')); } } } }
/** * Handle a POST user credential check in apioauthauthorization. * If given an OpenID URL, we'll pass us over to the regular things * and then redirect back here on completion. * * @fixme merge with common code for main OpenID login form * @param HTMLOutputter $action */ function onStartOAuthLoginCheck($action, &$user) { $provider = common_config('openid', 'trusted_provider'); if ($provider) { $openid_url = $provider; if (common_config('openid', 'append_username')) { $openid_url .= $action->trimmed('openid_username'); } } else { $openid_url = $action->trimmed('openid_url'); } if ($openid_url) { require_once dirname(__FILE__) . '/openid.php'; oid_assert_allowed($openid_url); $returnto = common_local_url('ApiOauthAuthorize', array(), array('oauth_token' => $action->arg('oauth_token'), 'mode' => $action->arg('mode'))); common_set_returnto($returnto); // This will redirect if functional... $result = oid_authenticate($openid_url, 'finishopenidlogin'); if (is_string($result)) { # error message throw new ServerException($result); } else { exit(0); } } return true; }
function oid_check_immediate($openid_url, $backto = null) { if (!$backto) { $action = $_REQUEST['action']; $args = common_copy_args($_GET); unset($args['action']); $backto = common_local_url($action, $args); } common_ensure_session(); $_SESSION['openid_immediate_backto'] = $backto; oid_authenticate($openid_url, 'finishimmediate', true); }
function oid_check_immediate($openid_url, $backto = null) { if (!$backto) { $action = $_REQUEST['action']; $args = common_copy_args($_GET); unset($args['action']); $backto = common_local_url($action, $args); } common_debug('going back to "' . $backto . '"', __FILE__); common_ensure_session(); $_SESSION['openid_immediate_backto'] = $backto; common_debug('passed-in variable is "' . $backto . '"', __FILE__); common_debug('session variable is "' . $_SESSION['openid_immediate_backto'] . '"', __FILE__); oid_authenticate($openid_url, 'finishimmediate', true); }
/** * Handle a POST request * * Muxes to different sub-functions based on which button was pushed * * @return void */ function handlePost() { // CSRF protection $token = $this->trimmed('token'); if (!$token || $token != common_session_token()) { $this->showForm(_m('网页错误,请返回重试 ')); return; } if ($this->arg('add')) { $result = oid_authenticate($this->trimmed('openid_url'), 'finishaddopenid'); if (is_string($result)) { // error message $this->showForm($result); } } else { if ($this->arg('remove')) { $this->removeOpenid(); } else { if ($this->arg('remove_trustroots')) { $this->removeTrustroots(); } else { $this->showForm(_m('Something weird happened.')); } } } }
/** * Handle a POST request * * Muxes to different sub-functions based on which button was pushed * * @return void */ protected function doPost() { if ($this->arg('add')) { if (common_config('openid', 'trusted_provider')) { // TRANS: Form validation error if no OpenID providers can be added. throw new ServerException(_m('Cannot add new providers.')); } else { $result = oid_authenticate($this->trimmed('openid_url'), 'finishaddopenid'); if (is_string($result)) { // error message throw new ServerException($result); } return _('Added new provider.'); } } else { if ($this->arg('remove')) { return $this->removeOpenid(); } else { if ($this->arg('remove_trustroots')) { return $this->removeTrustroots(); } else { if ($this->arg('save_prefs')) { return $this->savePrefs(); } } } } // TRANS: Unexpected form validation error. throw new ServerException(_m('No known action for POST.')); }