Beispiel #1
0
 /**
  * {@inheritdoc}
  */
 public function unlink_account(array $link_data)
 {
     if (!array_key_exists('oauth_service', $link_data) || !$link_data['oauth_service']) {
         return 'LOGIN_LINK_MISSING_DATA';
     }
     // Remove user specified in $link_data if possible
     $user_id = isset($link_data['user_id']) ? $link_data['user_id'] : $this->user->data['user_id'];
     // Remove the link
     $sql = 'DELETE FROM ' . $this->auth_provider_oauth_token_account_assoc . "\n\t\t\tWHERE provider = '" . $this->db->sql_escape($link_data['oauth_service']) . "'\n\t\t\t\tAND user_id = " . (int) $user_id;
     $this->db->sql_query($sql);
     // Clear all tokens belonging to the user on this servce
     $service_name = 'auth.provider.oauth.service.' . strtolower($link_data['oauth_service']);
     $storage = new \phpbb\auth\provider\oauth\token_storage($this->db, $this->user, $this->auth_provider_oauth_token_storage_table, $this->auth_provider_oauth_state_table);
     $storage->clearToken($service_name);
 }