engines/adva_user/vendor/plugins/authentication/lib/authentication/single_token.rb
# Will test to see if the given key is valid for the given user
Will test to see if the given key is valid for the given user
Will test to see if the given key is valid for the given user
def authenticate(user, key)
      return false unless valid_model? user
      return false unless key.to_s.length == 40
      conditions = [
        'id = ? AND token_key = ? AND (token_expiration >= ? OR token_expiration IS NULL)',
        user.id, hash_string(key), Time.zone.now
      ]
      0 < user.class.count(:conditions => conditions)
    end
def authenticate ( user , key ) return false unless valid_model? user return false unless key . to_s . length == 40 conditions = [ 'id = ? AND token_key = ? AND (token_expiration >= ? OR token_expiration IS NULL)' , user . id , hash_string ( key ) , Time . zone . now ] 0 < user . class . count ( :conditions => conditions ) end
Will test to see if the given key is valid for the given user
Will test to see if the given key is valid for the given user
user
key