Sha256: 8aa633a4ca68b4d5b5dbbdee537090ed3a1481c6fbe9b7959c2b94e516e24c25
Contents?: true
Size: 881 Bytes
Versions: 16
Compression:
Stored size: 881 Bytes
Contents
module Notee class ApplicationController < ActionController::Base before_action :restrict_access_json before_filter :set_request_filter def set_request_filter Thread.current[:request] = request end def restrict_access_json return redirect_to new_token_path unless confirm_exist_token return redirect_to new_token_path unless confirm_expired_token end private def confirm_exist_token unless Token.exists?(access_token: session[:access_token]) session.delete(:access_token) return false end true end def confirm_expired_token token = Token.find_by(access_token: session[:access_token]) return false unless token if Time.now > token.expires_at token.destroy session.delete(:access_token) return false end true end end end
Version data entries
16 entries across 16 versions & 1 rubygems