Sha256: f06644bc47cd74dcc3f9c9015f2a6edbf1c79c10408c2f75627811163a2c86c6

Contents?: true

Size: 496 Bytes

Versions: 4

Compression:

Stored size: 496 Bytes

Contents

module Adminpanel
  module SessionsHelper

    def sign_in(user)
      cookies.permanent[:remember_token] = user.remember_token
      self.current_user = user
    end

    def signed_in?
      !current_user.nil?
    end

    def current_user=(user)
      @current_user = user
    end

    def current_user
      @current_user ||= User.find_by_remember_token(cookies[:remember_token])
    end

    def sign_out
      self.current_user = nil
      cookies.delete(:remember_token)
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
adminpanel-2.1.7 app/helpers/adminpanel/sessions_helper.rb
adminpanel-2.1.6 app/helpers/adminpanel/sessions_helper.rb
adminpanel-2.1.5 app/helpers/adminpanel/sessions_helper.rb
adminpanel-2.1.3 app/helpers/adminpanel/sessions_helper.rb