def authenticate(username, password)
      user = find_user(username)
      hash = BCrypt::Password.new(user.password) rescue nil
      (hash && hash == password) ? user : nil
    end
def authenticate(username, password)
      user = find_user(username)
      hash = BCrypt::Password.new(user.password) rescue nil
      (hash && hash == password) ? user : nil
    end
Validate the username and password pair.

 username - The String login JID to verify.
 password - The String password the user presented to the server.

 Examples

   user = storage.authenticate('alice@wonderland.lit', 'secr3t')
   puts user.nil?

 This default implementation validates the password against a bcrypt hash
 of the password stored in the database. Sub-classes not using bcrypt
 passwords must override this method.

 Returns a Vines::User object on success, nil on failure.