26 lines
561 B
Ruby
26 lines
561 B
Ruby
# frozen_string_literal: true
|
|
class ApplicationController < ActionController::Base
|
|
protect_from_forgery with: :exception
|
|
|
|
add_flash_types :warning, :success
|
|
|
|
def current_candidate
|
|
@current_candidate ||= Candidate.find_by(test_hash: session[:test_id]) if session[:test_id]
|
|
end
|
|
helper_method :current_candidate
|
|
|
|
def styleguide
|
|
render '/styleguide'
|
|
end
|
|
|
|
private
|
|
|
|
def auth_params
|
|
params.require(:auth).permit(:email, :password)
|
|
end
|
|
|
|
def authorize_candidate
|
|
redirect_to login_path unless current_candidate
|
|
end
|
|
end
|