Sha256: b1d8a419861ac6c979aae6582736568895256db62ef7c45cf9328f92805b7491

Contents?: true

Size: 874 Bytes

Versions: 6

Compression:

Stored size: 874 Bytes

Contents

class OmniauthController < ApplicationController
	before_filter :authenticate_user!, :only => [ :logout ]

	def success
		session[:user_id] = env['omniauth.auth']
		user = User.new_from_omniauth(session[:user_id])
		redirect_to request.env['omniauth.origin'] || root_path, notice: "Successfully logged in"
	end

	def failure
		flash[:alert] = params[:message]
		#remember to add a template to render out or redirect to somewhere
	end

	# logout - Clear our rack session BUT essentially redirect to the provider to clean up the Devise session from there too !
	def login
		params[:provider] = "infinum" if !params[:provider]
		redirect_to "/auth/#{params[:provider]}?redirect_to=#{root_url}"
	end

	def logout
		session[:user_id] = nil
		redirect_to "#{ENV['omniauth_infinum_url']}/users/sign_out?redirect_to=#{root_url}", notice: 'You have successfully signed out!'
	end
end

Version data entries

6 entries across 3 versions & 1 rubygems

Version Path
omniauth-infinum-0.11.1 examples/omniauth_infinum_standalone/app/controllers/omniauth_controller.rb
omniauth-infinum-0.11.1 examples/omniauth_infinum_with_facebook/app/controllers/omniauth_controller.rb
omniauth-infinum-0.10.0 examples/omniauth_infinum_standalone/app/controllers/omniauth_controller.rb
omniauth-infinum-0.10.0 examples/omniauth_infinum_with_facebook/app/controllers/omniauth_controller.rb
omniauth-infinum-0.10.1 examples/omniauth_infinum_standalone/app/controllers/omniauth_controller.rb
omniauth-infinum-0.10.1 examples/omniauth_infinum_with_facebook/app/controllers/omniauth_controller.rb