示例#1
0
文件: cgd.py 项目: rebal691/mymoney
    def authenticate(self, user, password):
        logging.debug("authenticating...")

        def valid_parameter(parameter):
            ''' all char in user and passwd must be integers
            '''
            if not isinstance(parameter, str):
                parameter = str(parameter)
            for char in parameter:
                try:
                    int(char)
                except ValueError:
                    logging.error('invalid authentication parameter')
                    return False
            return True

        if valid_parameter(user) and valid_parameter(password):
            l1_html= self.get_page( LOGINSTARTPAGE, {"USERNAME": user} ) #needed to set
            auth_data= cxdo_auth.parameters(l1_html, user,password)
            l2_html= self.get_page( LOGINPAGE, auth_data, allow_redirects=True)

        if not self.is_authenticated():
            raise AuthenticationException("Could not authenticate with given data")
示例#2
0
文件: cgd.py 项目: webcracy/mymoney
    def authenticate(self, user, password):
        logging.debug("authenticating...")

        def valid_parameter(parameter):
            ''' all char in user and passwd must be integers
            '''
            if not isinstance(parameter, str):
                parameter = str(parameter)
            for char in parameter:
                try:
                    int(char)
                except ValueError:
                    logging.error('invalid authentication parameter')
                    return False
            return True

        if valid_parameter(user) and valid_parameter(password):
            l1_html= self.get_page( LOGINSTARTPAGE, {"USERNAME": user} ) #needed to set
            auth_data= cxdo_auth.parameters(l1_html, user,password)
            l2_html= self.get_page( LOGINPAGE, auth_data, allow_redirects=True)

        if not self.is_authenticated():
            raise AuthenticationException("Could not authenticate with given data")
示例#3
0
文件: urls.py 项目: goncalopp/pyCXDO
def login( login_start_page_html, username, password):
    auth_data= cxdo_auth.parameters(login_start_page_html, username,password) 
    return LOGIN, auth_data, True