Sha256: b6cca4109c6c50baa8384ac86ec270c94e0795e349a0722a889a57800889a549

Contents?: true

Size: 542 Bytes

Versions: 2

Compression:

Stored size: 542 Bytes

Contents

class ExpressTranslate::BaseController < ActionController::Base
  include ExpressTranslate
  
  def check_authentication
    token_store = getCookie(request.headers["HTTP_COOKIE"], "token")
    return (token_store.present? and Account.find_by_token(token_store).present?)
  end
  
  def getCookie(string, key)
    if string.present?
      string.split(";").each do |cookie|
        cookie.strip!
        _cookie = cookie.split("=")
        if _cookie[0] == key
          return _cookie[1]
        end
      end
    end
    return ""
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
express_translate-1.0 app/controllers/express_translate/base_controller.rb
express_translate-1.0.0.0 app/controllers/express_translate/base_controller.rb