Sha256: b51c68015327be0c6d2dd7661d983878f07800a63c4e0951fc78c036bd54c045

Contents?: true

Size: 540 Bytes

Versions: 3

Compression:

Stored size: 540 Bytes

Contents

class ApplicationController < ActionController::Base
  protect_from_forgery with: :exception

  def current_user
    if session[:username].present?
      @current_user ||= User.find_by(username: session[:username])
    end
  end
  helper_method :current_user

  def check_authentication
    unless session[:username].present?
      raise Dummy::Unauthorized
    end
  end

  def authenticated?
    session[:username].present?
  end


  def signin(username)
    session[:username] = username
  end

  def signout
    reset_session
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
dismissible_blocks-1.1.1 test/dummy/app/controllers/application_controller.rb
dismissible_blocks-1.1.0 test/dummy/app/controllers/application_controller.rb
dismissible_blocks-0.0.2 test/dummy/app/controllers/application_controller.rb