  def self.authenticate(attrs)

    return nil if attrs.nil? or attrs[:name].nil? or attrs[:password].nil?

    name = attrs[:name]
    password = attrs[:password]

    SqlHelper.validate_token([name])

    pass_md5 = UsersHelper.generate_digest_pass(name, password)

    return User.where("(name='#{name}') and (pass_md5='#{pass_md5}')").first
  end
The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.