about summary refs log tree commit diff stats
path: root/app/controllers/application_controller.rb
blob: c9d4e159e745f5c3bf53951e599d18d57d74f57e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
class ApplicationController < ActionController::Base
  protect_from_forgery with: :exception

  protected

    def authenticate_pokeviewer(login, token)
      user = login && User.find_by_login(login)

      ActiveSupport::SecurityUtils.secure_compare(
        ::Digest::SHA256.hexdigest(user.pokeviewer_token),
        ::Digest::SHA256.hexdigest(token))
    end

  private

    def after_sign_out_path_for(resource)
      new_session_path(resource)
    end
end