Sha256: 4d6ef690a1da46f904b87f4b7dd71656edea0f3652756f5d6c4ad04fa8cb0fdf
Contents?: true
Size: 713 Bytes
Versions: 5
Compression:
Stored size: 713 Bytes
Contents
class ExpressTranslate::BaseController < ActionController::Base include ExpressTranslate # Check login status by cookie def check_authentication token_store = Utils.getCookie(request.headers["HTTP_COOKIE"], "token") return (token_store.present? and Account.find_by_token(token_store).present?) end end class Utils # Get cookie form header action def self.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 # Utils.get_cookie("token=value; token2=value2", key).should == "value1,value2"
Version data entries
5 entries across 5 versions & 1 rubygems