Sha256: 41ca58bf416d889abcdaedbc20c8ba61b9b1c0b32e45ba9c00e3fafbba7df0e0

Contents?: true

Size: 391 Bytes

Versions: 2

Compression:

Stored size: 391 Bytes

Contents

module OdaniaOmniauthAuthentication
	module Helper
		def current_omniauth_user
			@current_user ||= Odania::User.find_by(id: session[:user_id])
		end

		def omniauth_signed_in?
			!!current_user
		end

		def user_authenticated_filter(opts)
			unless omniauth_signed_in?
				session[:return_to] = request.path
				return redirect_to '/sign_up', notice: 'Not authorized'
			end
		end
	end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
odania_omniauth_authentication-0.0.2 lib/odania_omniauth_authentication/helper.rb
odania_omniauth_authentication-0.0.1 lib/odania_omniauth_authentication/helper.rb