request = $request; $this->flash = $flash; $this->user_storage = $user_storage; } /** * @return JSON_Response|Redirect_Response|View_Response * * @throws User_Not_Found_Exception */ public function handle() { if ( ! $this->user_storage->is_totp_enabled() ) { if ( $this->request->is_ajax() ) { return $this->json( [ 'error' => Notification::get( 'totp-status-disabled' ), ], Code::FORBIDDEN ); } $this->flash->add_message( 'error', 'totp-status-disabled' ); return $this->redirect( new Action_URL( Action_Index::TWOFAS_ACTION_DEFAULT ) ); } return $this->next->handle(); } }