Sha256: 07acb5a33c85428e9ecb68f52099911c737e5eb3be6502d9740086a0b3846781

Contents?: true

Size: 607 Bytes

Versions: 8

Compression:

Stored size: 607 Bytes

Contents

class ExpressTranslate::BaseController < ActionController::Base
  include ExpressTranslate

  # Check login status by cookie
  def check_authentication
    token_store = getCookie(request.headers["HTTP_COOKIE"], "token")
    return (token_store.present? and Account.find_by_token(token_store).present?)
  end
  
  # Get cookie form header action
  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

8 entries across 8 versions & 1 rubygems

Version Path
express_translate-1.0.8 app/controllers/express_translate/base_controller.rb
express_translate-1.0.7 app/controllers/express_translate/base_controller.rb
express_translate-1.0.6 app/controllers/express_translate/base_controller.rb
express_translate-1.0.5 app/controllers/express_translate/base_controller.rb
express_translate-1.0.4 app/controllers/express_translate/base_controller.rb
express_translate-1.0.3 app/controllers/express_translate/base_controller.rb
express_translate-1.0.2 app/controllers/express_translate/base_controller.rb
express_translate-1.0.1 app/controllers/express_translate/base_controller.rb