From b2ac27f392201194156412cd6d2b87887a3517fa Mon Sep 17 00:00:00 2001 From: Romain Bignon Date: Wed, 12 Feb 2020 22:06:53 +0100 Subject: [PATCH] boursorama: cleanup useless things, and use ValueTransient --- modules/boursorama/browser.py | 19 ++++++------------- modules/boursorama/module.py | 8 +++----- modules/boursorama/pages.py | 6 ------ 3 files changed, 9 insertions(+), 24 deletions(-) diff --git a/modules/boursorama/browser.py b/modules/boursorama/browser.py index 6dae69f40a..0c8e2153a3 100644 --- a/modules/boursorama/browser.py +++ b/modules/boursorama/browser.py @@ -163,18 +163,13 @@ def load_state(self, state): def handle_authentication(self): if self.authentication.is_here(): self.check_interactive() - if self.config['enable_twofactors'].get(): - confirmation_link = self.page.get_confirmation_link() - if confirmation_link: - self.location(confirmation_link) - self.page.sms_first_step() - self.page.sms_second_step() - else: - raise BrowserIncorrectAuthenticationCode( - """Boursorama - activate the two factor authentication in boursorama config.""" - """ You will receive SMS code but are limited in request per day (around 15)""" - ) + confirmation_link = self.page.get_confirmation_link() + if confirmation_link: + self.location(confirmation_link) + + self.page.sms_first_step() + self.page.sms_second_step() def handle_sms(self): # regular 2FA way @@ -192,8 +187,6 @@ def handle_sms(self): raise BrowserIncorrectAuthenticationCode() def init_login(self): - assert isinstance(self.config['device'].get(), basestring) - assert isinstance(self.config['enable_twofactors'].get(), bool) if not self.password.isalnum(): raise BrowserIncorrectPassword() diff --git a/modules/boursorama/module.py b/modules/boursorama/module.py index 2f60e3b77c..fd32d9aadf 100644 --- a/modules/boursorama/module.py +++ b/modules/boursorama/module.py @@ -28,7 +28,7 @@ from weboob.capabilities.profile import CapProfile from weboob.capabilities.contact import CapContact from weboob.tools.backend import Module, BackendConfig -from weboob.tools.value import ValueBackendPassword, ValueBool, Value +from weboob.tools.value import ValueBackendPassword, ValueTransient from .browser import BoursoramaBrowser @@ -45,10 +45,8 @@ class BoursoramaModule(Module, CapBankWealth, CapBankTransferAddRecipient, CapPr DESCRIPTION = u'Boursorama' CONFIG = BackendConfig(ValueBackendPassword('login', label='Identifiant', masked=False), ValueBackendPassword('password', label='Mot de passe'), - ValueBool('enable_twofactors', label='Send validation sms', default=False), - Value('device', label='Device name', regexp='\w*', default='weboob'), - Value('pin_code', label='Sms code', required=False, default=''), - Value('request_information', default=None, noprompt=True, required=False), + ValueTransient('pin_code'), + ValueTransient('request_information'), ) BROWSER = BoursoramaBrowser diff --git a/modules/boursorama/pages.py b/modules/boursorama/pages.py index 744dbca055..324c0d4fce 100644 --- a/modules/boursorama/pages.py +++ b/modules/boursorama/pages.py @@ -52,10 +52,6 @@ from weboob.exceptions import BrowserQuestion, BrowserIncorrectPassword, BrowserHTTPNotFound, BrowserUnavailable, ActionNeeded -class BrowserAuthenticationCodeMaxLimit(BrowserIncorrectPassword): - pass - - class IncidentPage(HTMLPage): pass @@ -89,8 +85,6 @@ def sms_first_step(self): """ This function simulates the registration of a device on boursorama two factor authentification web page. - @param device device name to register - @exception BrowserAuthenticationCodeMaxLimit when daily limit is consumed """ form = self.get_form() form.submit() -- GitLab