def init_transfer(self, account, recipient, transfer): data = { 'amount': transfer.amount, 'executionDate': transfer.exec_date.strftime('%Y-%m-%d'), 'keyPadSize': {'width': 3800, 'height': 1520}, 'label': transfer.label, 'fromAccount': account._uid, 'toAccount': recipient.id } try: self.init_transfer_page.go(json=data, headers={'Referer': self.absurl('/secure/transfers/new')}) except ClientError as e: self.handle_transfer_errors(e) if self.page.is_otp_authentication(): raise AuthMethodNotImplemented() suggested_date = self.page.suggested_date if transfer.exec_date and transfer.exec_date < suggested_date: transfer.exec_date = suggested_date assert suggested_date == transfer.exec_date, "Transfer date is not valid" self.transfer_data = data self.transfer_data.pop('keyPadSize') self.transfer_data['clickPositions'] = self.page.get_password_coord(self.password) return transfer
def init_login(self): self.login.go() # 2FA already done, if valid, login() redirects to home page if self.twofa_auth_state: self.session.cookies.set('auth_client_state', self.twofa_auth_state['value']) self.page.login(self.username, self.password, redirect=True) if not self.page.logged: # 302 redirect to catch to know if polling self.page.login(self.username, self.password) self.check_redirections() # for cic, there is two redirections self.check_redirections() if self.twofa_unabled_page.is_here(): raise ActionNeeded(self.page.get_error_msg()) # when people try to log in but there are on a sub site of creditmutuel if not self.page and not self.url.startswith(self.BASEURL): raise BrowserIncorrectPassword() if self.login_error.is_here(): raise BrowserIncorrectPassword() if self.verify_pass.is_here(): raise AuthMethodNotImplemented("L'identification renforcée avec la carte n'est pas supportée.") self.check_auth_methods() self.getCurrentSubBank()
def choose_device(self): # When there is no "Confirmer" button, # it means that the device pop up appeared (it is called by js) if ( not self.doc.xpath('//input[@value="Confirmer"]') or self.doc.xpath('//input[@name="codeOTPSaisi"]') ): # transfer validation form with sms cannot be tested yet raise AuthMethodNotImplemented() assert False, 'Should not be on confirmation page after posting the form.'
def do_login(self): if not self.login_page.is_here(): self.location('/fr/identification.jsp') self.page.login(self.username, self.password) if self.login_page.is_here(): raise BrowserIncorrectPassword() self.location('/fr/prive/default.jsp?ANav=1') if self.accounts_page.is_here() and self.page.need_sms(): raise AuthMethodNotImplemented( 'Authentification with sms is not supported')
def do_login(self): # Clear cookies. self.do_logout() self.login.go() if not self.page.logged: self.page.login(self.username, self.password) if not self.page.logged or self.login_error.is_here(): raise BrowserIncorrectPassword() if self.verify_pass.is_here(): raise AuthMethodNotImplemented( "L'identification renforcée avec la carte n'est pas supportée." ) self.getCurrentSubBank()
def on_load(self): if self.doc['commun']['statut'].lower() == 'nok': reason = self.doc['commun']['raison'] if reason == 'SYD-COMPTES-UNAUTHORIZED-ACCESS': raise NoAccountsException( "Vous n'avez pas l'autorisation de consulter : {}".format( reason)) elif reason == 'niv_auth_insuff': raise BrowserIncorrectPassword( 'Vos identifiants sont incorrects') elif reason == 'chgt_mdp_oblig': raise BrowserPasswordExpired( 'Veuillez renouveler votre mot de passe') elif reason == 'oob_insc_oblig': raise AuthMethodNotImplemented( "L'authentification par Secure Access n'est pas prise en charge" ) raise BrowserUnavailable(reason)
def do_login(self): # Clear cookies. self.do_logout() self.login.go() if not self.page.logged: self.page.login(self.username, self.password) # Many "Credit Mutuel" customers tried to add their connection to BECM, but the BECM # website does not return any error when you try to login with correct Crédit Mutuel # credentials, therefore we must suggest them to try regular Crédit Mutuel if login fails. if self.login.is_here(): raise ActionNeeded( "La connexion au site de BECM n'a pas fonctionné avec les identifiants fournis.\ Si vous êtes client du Crédit Mutuel, veuillez réessayer en sélectionnant le module Crédit Mutuel." ) if self.verify_pass.is_here(): raise AuthMethodNotImplemented( "L'identification renforcée avec la carte n'est pas supportée." )
def on_load(self): if self.doc['commun']['statut'].lower() == 'nok': reason = self.doc['commun']['raison'] if reason == 'SYD-COMPTES-UNAUTHORIZED-ACCESS': raise NoAccountsException( "Vous n'avez pas l'autorisation de consulter : {}".format( reason)) elif reason == 'niv_auth_insuff': return elif reason in ('chgt_mdp_oblig', 'chgt_mdp_init'): raise BrowserPasswordExpired( 'Veuillez vous rendre sur le site de la banque pour renouveler votre mot de passe' ) elif reason == 'oob_insc_oblig': raise AuthMethodNotImplemented( "L'authentification par Secure Access n'est pas prise en charge" ) else: # the BrowserUnavailable was raised for every unknown error, and was masking the real error. # So users and developers didn't know what kind of error it was. assert False, 'Error %s is not handled yet.' % reason
def do_login(self): # Clear cookies. self.do_logout() self.login.go() if not self.page.logged: self.page.login(self.username, self.password) # when people try to log in but there are on a sub site of creditmutuel if not self.page and not self.url.startswith(self.BASEURL): raise BrowserIncorrectPassword() if not self.page.logged or self.login_error.is_here(): raise BrowserIncorrectPassword() if self.verify_pass.is_here(): raise AuthMethodNotImplemented( "L'identification renforcée avec la carte n'est pas supportée." ) self.getCurrentSubBank()
def on_load(self): if self.doc.xpath( '//p[contains(text(), "You have activated the double factor authentication")]' ): raise AuthMethodNotImplemented( 'Two-Factor authentication is not supported.')
def on_load(self): if Dict('statusText', default="")(self.doc) == "totpNeeded": raise AuthMethodNotImplemented( "Time-based One-time Password is not supported")