Sha256: 567efd9bc9281539ef70b7ebf69f8da9385bda167fde874fd1912bef85cc400e

Contents?: true

Size: 880 Bytes

Versions: 3

Compression:

Stored size: 880 Bytes

Contents

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

	def success
		session[:user_id] = env['omniauth.auth']
		user = USER_MODEL.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

3 entries across 3 versions & 1 rubygems

Version Path
omniauth-infinum-0.11.1 lib/generators/infinum/omniauth/templates/rails/app/controllers/omniauth_controller.rb
omniauth-infinum-0.10.0 lib/generators/infinum/omniauth/templates/rails/app/controllers/omniauth_controller.rb
omniauth-infinum-0.10.1 lib/generators/infinum/omniauth/templates/rails/app/controllers/omniauth_controller.rb