step_token = $step_token; $this->request = $request; } /** * @param null|WP_Error|WP_User $user * * @return bool */ public function supports( $user ) { if ( $this->is_wp_user( $user ) ) { return false; } try { $this->get_wp_user(); return $this->request->is_login_action_equal_to( Login_Action::STOP_LOGIN_PROCESS ); } catch ( User_Not_Found_Exception $e ) { return false; } } /** * @param null|WP_Error|WP_User $user * * @return bool|JSON_Response|Redirection_Response|View_Response */ protected function handle( $user ) { $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->redirection( $login_url ); } }