lib/applicaster/sessions_controller_mixin.rb in omniauth-applicaster-1.8.0 vs lib/applicaster/sessions_controller_mixin.rb in omniauth-applicaster-1.9.0

- old
+ new

@@ -1,26 +1,33 @@ module Applicaster module SessionsControllerMixin def new + Rails.logger.info("New session initiated. Redirecting to /auth/applicaster. IP: #{request.remote_ip}, User Agent: #{request.user_agent}") redirect_to "/auth/applicaster" end def create session[:omniauth_credentials] = omniauth_credentials + Rails.logger.info("Session created successfully for user. IP: #{request.remote_ip}, User Agent: #{request.user_agent}, Params: #{safe_user_params.inspect}") redirect_to(session.delete(:path_before_login) || '/') end def destroy - reset_session + user_email = current_user.email rescue "Unknown" + Rails.logger.info("Session destroyed for user: #{user_email}. IP: #{request.remote_ip}, User Agent: #{request.user_agent}") - redirect_to "/" + reset_session + redirect_to config.base_url end def failure - Rails.logger.warn({ - message: "Omniauth error with strategy '#{params[:strategy]}': #{params[:message]}", + Rails.logger.error({ + message: "[Login Failed] - Omniauth error with strategy '#{params[:strategy]}': #{params[:message]}", origin: params[:origin], + IP: request.remote_ip, + UserAgent: request.user_agent, + Params: params[:origin], }) flash[:notice] = "There was a problem logging in" redirect_to "/" end