Sha256: 2e7aee2dd77eed4c9b344e1a4cdab17aee5dbf4779b7ed878ba60733f6625fa6
Contents?: true
Size: 547 Bytes
Versions: 9
Compression:
Stored size: 547 Bytes
Contents
module Exposition module Admin::SessionsHelper def current_user if (user_id = session[:user_id]) @current_user ||= User.find_by(id: user_id) elsif (user_id = cookies.signed[:user_id]) # TODO put this in admin controller for authentication check user = User.find_by(id: user_id) if user && user.authenticated?(cookies[:remember_token]) session[:user_id] = user.id @current_user = user end end end def logged_in? !current_user.nil? end end end
Version data entries
9 entries across 9 versions & 1 rubygems