Beispiel #1
0
function oid_get_user($openid_url)
{
    $user = null;
    $oid = User_openid::staticGet('canonical', $openid_url);
    if ($oid) {
        $user = User::staticGet('id', $oid->user_id);
    }
    return $user;
}
Beispiel #2
0
 /**
  * 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::staticGet('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;
 }
Beispiel #3
0
 /**
  * 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::staticGet('canonical', $openid_url);
     if (!$oid) {
         $this->showForm(_m('No such OpenID.'));
         return;
     }
     $cur = common_current_user();
     if (!$cur || $oid->user_id != $cur->id) {
         $this->showForm(_m('That OpenID does not belong to you.'));
         return;
     }
     $oid->delete();
     $this->showForm(_m('OpenID removed.'), true);
     return;
 }