From e94282a7c2d567c5a7d66ef15141c7dcb54182b8 Mon Sep 17 00:00:00 2001 From: Guido Schweizer Date: Mon, 2 Feb 2026 21:39:31 +0100 Subject: [PATCH] fix redirect loop --- app/controllers/spotify_controller.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/controllers/spotify_controller.rb b/app/controllers/spotify_controller.rb index d0d1d4e..0a00150 100644 --- a/app/controllers/spotify_controller.rb +++ b/app/controllers/spotify_controller.rb @@ -2,13 +2,13 @@ class SpotifyController < ApplicationController before_action :authenticate_user! def index - # If already connected, redirect to dashboard - redirect_to statistics_path if current_user.logins.exists?(platform: "spotify") + # If already connected and alive, redirect to dashboard + redirect_to statistics_path if current_user.logins.alive.exists?(platform: "spotify") end def connect - # If user already has a login, redirect to statistics dashboard - return redirect_to statistics_path if current_user.logins.exists?(platform: "spotify") + # If user already has an alive login, redirect to statistics dashboard + return redirect_to statistics_path if current_user.logins.alive.exists?(platform: "spotify") client_id = ENV["SPOTIFY_CLIENT_ID"] redirect_uri = SpotifyClient::SPOTIFY_REDIRECT_URI scope = SpotifyClient::SCOPE