2016-09-08 10:25:33 -05:00
|
|
|
# frozen_string_literal: true
|
2016-07-26 11:59:23 -05:00
|
|
|
class ApplicationController < ActionController::Base
|
|
|
|
protect_from_forgery with: :exception
|
2016-07-29 11:53:01 -05:00
|
|
|
|
2016-08-24 12:15:12 -05:00
|
|
|
add_flash_types :warning, :success
|
|
|
|
|
2016-07-29 11:53:01 -05:00
|
|
|
def current_candidate
|
2016-07-31 09:56:02 -05:00
|
|
|
@current_candidate ||= Candidate.find_by(test_hash: session[:test_id]) if session[:test_id]
|
2016-07-29 11:53:01 -05:00
|
|
|
end
|
2016-08-02 18:30:15 -05:00
|
|
|
helper_method :current_candidate
|
2016-07-31 09:56:02 -05:00
|
|
|
|
2016-08-24 08:23:29 -05:00
|
|
|
def styleguide
|
|
|
|
render '/styleguide'
|
|
|
|
end
|
|
|
|
|
2016-07-31 09:56:02 -05:00
|
|
|
private
|
|
|
|
|
|
|
|
def auth_params
|
|
|
|
params.require(:auth).permit(:email, :password)
|
|
|
|
end
|
|
|
|
|
2016-07-31 18:54:12 -05:00
|
|
|
def authorize_candidate
|
2016-08-02 18:02:20 -05:00
|
|
|
redirect_to login_path unless current_candidate
|
2016-07-31 18:54:12 -05:00
|
|
|
end
|
2016-07-26 11:59:23 -05:00
|
|
|
end
|