lib/ditty/helpers/authentication.rb in ditty-0.7.0 vs lib/ditty/helpers/authentication.rb in ditty-0.7.1
- old
+ new
@@ -6,11 +6,11 @@
module Ditty
module Helpers
module Authentication
def current_user
- return anonymous_user if current_user_id.nil?
+ return nil if current_user_id.nil?
@current_user ||= User[current_user_id]
end
def current_user=(user)
env['rack.session'] = {} if env['rack.session'].nil?
@@ -37,14 +37,9 @@
end
def logout
env['rack.session'].delete('user_id') unless env['rack.session'].nil?
env.delete('omniauth.auth')
- end
-
- def anonymous_user
- role = ::Ditty::Role.where(name: 'anonymous').first
- ::Ditty::User.where(roles: role).first unless role.nil?
end
end
class NotAuthenticated < StandardError
end