Module: OdaniaOmniauthAuthentication::Helper

Defined in:
lib/odania_omniauth_authentication/helper.rb

Instance Method Summary collapse

Instance Method Details

#current_omniauth_userObject



3
4
5
# File 'lib/odania_omniauth_authentication/helper.rb', line 3

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

#omniauth_signed_in?Boolean

Returns:

  • (Boolean)


7
8
9
# File 'lib/odania_omniauth_authentication/helper.rb', line 7

def omniauth_signed_in?
	!!current_user
end

#user_authenticated_filter(opts) ⇒ Object



11
12
13
14
15
16
# File 'lib/odania_omniauth_authentication/helper.rb', line 11

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