Files
ocelots/app/controllers/application_controller.rb
T
2012-08-13 18:47:47 +08:00

18 lines
324 B
Ruby

class ApplicationController < ActionController::Base
protect_from_forgery
before_filter :require_login
def require_login
redirect_to root_url unless logged_in?
end
def logged_in?
!!current_user
end
def current_user
return nil unless session[:email]
@current_user = session[:email]
end
end