Skip to content

Commit

Permalink
fix for #984
Browse files Browse the repository at this point in the history
  • Loading branch information
mevdschee committed Aug 10, 2023
1 parent 81af3ed commit 3bcd7f8
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Tqdev/PhpCrudApi/Middleware/WpAuthMiddleware.php
Expand Up @@ -38,7 +38,7 @@ public function process(ServerRequestInterface $request, RequestHandlerInterface
'remember' => false,
]);
if ($user->ID) {
unset($user['user_pass']);
unset($user->data->user_pass);
return $this->responder->success($user);
}
return $this->responder->error(ErrorCode::AUTHENTICATION_FAILED, $username);
Expand All @@ -47,15 +47,15 @@ public function process(ServerRequestInterface $request, RequestHandlerInterface
if (is_user_logged_in()) {
wp_logout();
$user = wp_get_current_user();
unset($user['user_pass']);
unset($user->data->user_pass);
return $this->responder->success($user);
}
return $this->responder->error(ErrorCode::AUTHENTICATION_REQUIRED, '');
}
if ($method == 'GET' && $path == 'me') {
if (is_user_logged_in()) {
$user = wp_get_current_user();
unset($user['user_pass']);
unset($user->data->user_pass);
return $this->responder->success($user);
}
return $this->responder->error(ErrorCode::AUTHENTICATION_REQUIRED, '');
Expand Down

0 comments on commit 3bcd7f8

Please sign in to comment.