class Bundler::URI::Generic

def check_password(v, user = @user)


with a user component defined.
Can not have a registry or opaque component defined,

and against the Bundler::URI::Parser Regexp for :USERINFO.
Checks the password +v+ component for RFC2396 compliance
def check_password(v, user = @user)
  if @opaque
    raise InvalidURIError,
      "can not set password with opaque"
  end
  return v unless v
  if !user
    raise InvalidURIError,
      "password component depends user component"
  end
  if parser.regexp[:USERINFO] !~ v
    raise InvalidComponentError,
      "bad password component"
  end
  return true
end