Skip to content

Commit 4f5fb00

Browse files
committed
Redirect to login page if user isn't authenticated
1 parent 7a393d1 commit 4f5fb00

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

lib/class-wp-json-authentication-oauth1-authorize.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ public function register_hooks() {
3838
* default wp-login handlers.
3939
*/
4040
public function handle_request() {
41+
if ( ! is_user_logged_in() ) {
42+
wp_safe_redirect( wp_login_url( $_SERVER['REQUEST_URI'] ) );
43+
exit;
44+
}
45+
4146
$response = $this->render_page();
4247
if ( is_wp_error( $response ) ) {
4348
$this->display_error( $response );

0 commit comments

Comments
 (0)