/** * Handles a request to remove an OpenID from the user's account * * Validates input and, if everything is OK, deletes the OpenID. * Reloads the form with a success or error notification. * * @return void */ function removeOpenid() { $oid = User_openid::getKV('canonical', $this->trimmed('openid_url')); if (!$oid instanceof User_openid) { // TRANS: Form validation error for a non-existing OpenID. throw new ClientException(_m('No such OpenID.')); } if ($this->scoped->getID() !== $oid->user_id) { // TRANS: Form validation error if OpenID is connected to another user. throw new ClientException(_m('That OpenID does not belong to you.')); } $oid->delete(); // TRANS: Success message after removing an OpenID. return _m('OpenID removed.'); }
function oid_get_user($openid_url) { $user = null; $oid = User_openid::getKV('canonical', $openid_url); if ($oid) { $user = User::getKV('id', $oid->user_id); } return $user; }
/** * Handles a request to remove an OpenID from the user's account * * Validates input and, if everything is OK, deletes the OpenID. * Reloads the form with a success or error notification. * * @return void */ function removeOpenid() { $openid_url = $this->trimmed('openid_url'); $oid = User_openid::getKV('canonical', $openid_url); if (!$oid) { // TRANS: Form validation error for a non-existing OpenID. $this->showForm(_m('No such OpenID.')); return; } $cur = common_current_user(); if (!$cur || $oid->user_id != $cur->id) { // TRANS: Form validation error if OpenID is connected to another user. $this->showForm(_m('That OpenID does not belong to you.')); return; } $oid->delete(); // TRANS: Success message after removing an OpenID. $this->showForm(_m('OpenID removed.'), true); return; }