| @@ -40,16 +40,15 @@ | ||
| 40 | 40 | public function generate_auth_cookie() { |
| 41 | 41 | |
| 42 | 42 | global $json_api; |
| 43 | 43 | |
| 44 | + /* | |
| 44 | 45 | $nonce_id = $json_api->get_nonce_id('auth', 'generate_auth_cookie'); |
| 45 | 46 | |
| 46 | - | |
| 47 | - | |
| 48 | 47 | if (!wp_verify_nonce($json_api->query->nonce, $nonce_id)) { |
| 49 | 48 | |
| 50 | 49 | $json_api->error("Your 'nonce' value was incorrect. Use the 'get_nonce' API method."); |
| 51 | - } | |
| 50 | + }*/ | |
| 52 | 51 | |
| 53 | 52 | |
| 54 | 53 | if (!$json_api->query->username) { |
| 55 | 54 | |
| @@ -88,8 +87,9 @@ | ||
| 88 | 87 | preg_match('|src="(.+?)"|', get_avatar( $user->ID, 32 ), $avatar); |
| 89 | 88 | |
| 90 | 89 | return array( |
| 91 | 90 | "cookie" => $cookie, |
| 91 | + "cookie_name" => LOGGED_IN_COOKIE, | |
| 92 | 92 | "user" => array( |
| 93 | 93 | "id" => $user->ID, |
| 94 | 94 | "username" => $user->user_login, |
| 95 | 95 | "nicename" => $user->user_nicename, |
| @@ -106,41 +106,8 @@ | ||
| 106 | 106 | |
| 107 | 107 | ), |
| 108 | 108 | ); |
| 109 | 109 | } |
| 110 | - | |
| 111 | - | |
| 112 | -/* | |
| 113 | -public function clear_auth_cookie() { | |
| 114 | - global $json_api; | |
| 115 | - if (!$json_api->query->cookie) { | |
| 116 | - | |
| 117 | - $json_api->error("You must include a valid 'cookie' to clear it."); | |
| 118 | - } | |
| 119 | - | |
| 120 | - | |
| 121 | - | |
| 122 | - $user_id = wp_validate_auth_cookie($json_api->query->cookie, 'logged_in'); | |
| 123 | - | |
| 124 | - | |
| 125 | - if (!$user_id) { | |
| 126 | - $json_api->error("Invalid authentication cookie. Provide a valid cookie to clear."); | |
| 127 | - } | |
| 128 | - | |
| 129 | - | |
| 130 | - $expiration = time() + apply_filters('auth_cookie_expiration', -1209600, $user_id, true); | |
| 131 | - | |
| 132 | - $cookie = wp_generate_auth_cookie($user_id, $expiration, 'logged_in'); | |
| 133 | - | |
| 134 | - $valid = wp_validate_auth_cookie($cookie, 'logged_in') ? true : false; | |
| 135 | - | |
| 136 | - | |
| 137 | - return array( | |
| 138 | - "valid" => $valid | |
| 139 | - ); | |
| 140 | - | |
| 141 | - } | |
| 142 | -*/ | |
| 143 | 110 | |
| 144 | 111 | |
| 145 | 112 | public function get_currentuserinfo() { |
| 146 | 113 | global $json_api; |