Sha256: 264c5a8da4ba3f9cbbef7493cad87314f5757e273e59e793b9c4f1cf03c07ef8

Contents?: true

Size: 452 Bytes

Versions: 20

Compression:

Stored size: 452 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

20 entries across 20 versions & 1 rubygems

Version Path
adminpanel-2.1.2 app/helpers/adminpanel/sessions_helper.rb
adminpanel-2.1.1 app/helpers/adminpanel/sessions_helper.rb
adminpanel-2.1.0 app/helpers/adminpanel/sessions_helper.rb
adminpanel-2.0.1 app/helpers/adminpanel/sessions_helper.rb
adminpanel-2.0.0 app/helpers/adminpanel/sessions_helper.rb
adminpanel-1.2.12 app/helpers/adminpanel/sessions_helper.rb
adminpanel-1.2.11 app/helpers/adminpanel/sessions_helper.rb
adminpanel-1.2.10 app/helpers/adminpanel/sessions_helper.rb
adminpanel-1.2.9 app/helpers/adminpanel/sessions_helper.rb
adminpanel-1.2.8 app/helpers/adminpanel/sessions_helper.rb
adminpanel-1.2.7 app/helpers/adminpanel/sessions_helper.rb
adminpanel-1.2.6 app/helpers/adminpanel/sessions_helper.rb
adminpanel-1.2.5 app/helpers/adminpanel/sessions_helper.rb
adminpanel-1.2.4 app/helpers/adminpanel/sessions_helper.rb
adminpanel-1.2.3 app/helpers/adminpanel/sessions_helper.rb
adminpanel-1.2.2 app/helpers/adminpanel/sessions_helper.rb
adminpanel-1.2.1 app/helpers/adminpanel/sessions_helper.rb
adminpanel-1.2.0 app/helpers/adminpanel/sessions_helper.rb
adminpanel-1.1.0 app/helpers/adminpanel/sessions_helper.rb
adminpanel-1.0.0 app/helpers/adminpanel/sessions_helper.rb