add re-init ui
This commit is contained in:
@@ -7,8 +7,13 @@ class ApplicationController < ActionController::Base
|
|||||||
private
|
private
|
||||||
|
|
||||||
def check_spotify_login
|
def check_spotify_login
|
||||||
if user_signed_in? && current_user.logins.where(platform: "spotify").none?
|
return unless user_signed_in?
|
||||||
|
spotify_login = current_user.logins.where(platform: "spotify").order(created_at: :desc).first
|
||||||
|
if spotify_login.nil? || spotify_login.dead_since.present?
|
||||||
unless request.path == spotify_connect_path || request.path == spotify_path || request.path == spotify_callback_path || devise_controller?
|
unless request.path == spotify_connect_path || request.path == spotify_path || request.path == spotify_callback_path || devise_controller?
|
||||||
|
if spotify_login&.dead_since.present?
|
||||||
|
flash[:alert] = "Your Spotify login expired and became invalid on #{spotify_login.dead_since.strftime('%Y-%m-%d %H:%M:%S')}. Please reconnect."
|
||||||
|
end
|
||||||
redirect_to spotify_path
|
redirect_to spotify_path
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user