user_storage = $user_storage; $this->step_token = $step_token; $this->request = $request; } /** * @param WP_Error|WP_User $user * @param JSON_Response|View_Response|null $response * * @return JSON_Response|Redirect_Response|View_Response|null */ public function handle( $user, $response = null ) { if ( ! $this->is_wp_user( $user ) && $this->user_storage->is_wp_user_set() && $this->request->is_login_action_equal_to( Login_Action::STOP_LOGIN_PROCESS ) ) { $this->step_token->reset(); $login_url = wp_login_url(); $interim_login = $this->request->request( 'interim-login' ); if ( $interim_login ) { $login_url = add_query_arg( 'interim-login', '1', $login_url ); } return $this->redirect( $login_url ); } return $this->run_next( $user, $response ); } }