mirror of
https://github.com/fluent/fluentd-ui.git
synced 2025-08-12 01:07:09 +02:00
17 lines
474 B
Ruby
17 lines
474 B
Ruby
class ApplicationController < ActionController::Base
|
|
# Prevent CSRF attacks by raising an exception.
|
|
# For APIs, you may want to use :null_session instead.
|
|
protect_from_forgery with: :exception
|
|
helper_method :current_user
|
|
|
|
def current_user
|
|
return unless session[:remember_token]
|
|
@current_user ||= User.find_by(remember_token: session[:remember_token])
|
|
end
|
|
|
|
def login_required
|
|
return true if current_user
|
|
redirect_to new_sessions_path
|
|
end
|
|
end
|