perceval/backends/core/bugzilla.py
def login(self, user, password):
        """Authenticate a user in the server.

        :param user: Bugzilla user
        :param password: user password
        """
        url = self.URL % {'base': self.base_url, 'cgi': self.CGI_LOGIN}

        payload = {
            self.PBUGZILLA_LOGIN: user,
            self.PBUGZILLA_PASSWORD: password,
            self.PLOGIN: 'Log in'
        }

        headers = {'Referer': self.base_url}

        req = self.fetch(url, payload=payload, headers=headers, method=HttpClient.POST)

        # Check if the authentication went OK. When this string
        # is found means that the authentication was successful
        if req.text.find("index.cgi?logout=1") < 0:
            cause = ("Bugzilla client could not authenticate user %s. "
                     "Please check user and password parameters. "
                     "URLs may also need a trailing '/'.") % user
            raise BackendError(cause=cause)

        logger.debug("Bugzilla user %s authenticated in %s",
                     user, self.base_url)
def login(self, user, password):
        """Authenticate a user in the server.

        :param user: Bugzilla user
        :param password: user password
        """
        url = self.URL % {'base': self.base_url, 'cgi': self.CGI_LOGIN}

        payload = {
            self.PBUGZILLA_LOGIN: user,
            self.PBUGZILLA_PASSWORD: password,
            self.PLOGIN: 'Log in'
        }

        headers = {'Referer': self.base_url}

        req = self.fetch(url, payload=payload, headers=headers, method=HttpClient.POST)

        # Check if the authentication went OK. When this string
        # is found means that the authentication was successful
        if req.text.find("index.cgi?logout=1") < 0:
            cause = ("Bugzilla client could not authenticate user %s. "
                     "Please check user and password parameters. "
                     "URLs may also need a trailing '/'.") % user
            raise BackendError(cause=cause)

        logger.debug("Bugzilla user %s authenticated in %s",
                     user, self.base_url)
Authenticate a user in the server.

        :param user: Bugzilla user
        :param password: user password