lib/glogin/cookie.rb
def to_user
        plain = Codec.new(@secret).decrypt(@text)
        id, login, avatar, bearer, ctx = plain.split(GLogin::SPLIT, 5)
        if !@secret.empty? && ctx.to_s != @context
          raise(
            GLogin::Codec::DecodingError,
            "Context '#{@context}' expected, but '#{ctx}' found"
          )
        end
        { id: id, login: login, avatar: avatar, bearer: bearer }
      end
# Returns a hash with two elements: login and avatar.
# If the secret is empty, the text will be returned, without
# any decryption. If the data is not valid, an exception
# GLogin::Codec::DecodingError will be raised, which you have
# to catch in your applicaiton and ignore the login attempt.
Returns a hash with two elements: login and avatar.
If the secret is empty, the text will be returned, without
any decryption. If the data is not valid, an exception
GLogin::Codec::DecodingError will be raised, which you have
to catch in your applicaiton and ignore the login attempt.
Returns a hash with two elements : login and avatar . If the secret is empty the text will be returned without any decryption . If the data is not valid an exception GLogin :: Codec :: DecodingError will be raised which you have to catch in your applicaiton and ignore the login attempt .
def to_user
        plain = Codec.new(@secret).decrypt(@text)
        id, login, avatar, bearer, ctx = plain.split(GLogin::SPLIT, 5)
        if !@secret.empty? && ctx.to_s != @context
          raise(
            GLogin::Codec::DecodingError,
            "Context '#{@context}' expected, but '#{ctx}' found"
          )
        end
        { id: id, login: login, avatar: avatar, bearer: bearer }
      end
def to_user plain = Codec . new ( @secret ) . decrypt ( @text ) id , login , avatar , bearer , ctx = plain . split ( GLogin :: SPLIT , 5 ) if ! @secret . empty? && ctx . to_s != @context raise ( GLogin :: Codec :: DecodingError , "Context '#{@context}' expected, but '#{ctx}' found" ) end { id : id , login : login , avatar : avatar , bearer : bearer } end
Returns a hash with two elements: login and avatar.
Returns a hash with two elements : login and avatar .