Commit b2ac27f3 authored by Romain Bignon's avatar Romain Bignon

boursorama: cleanup useless things, and use ValueTransient

parent e00cc9b2
Pipeline #2966 passed with stages
in 12 minutes and 53 seconds
......@@ -163,18 +163,13 @@ class BoursoramaBrowser(RetryLoginBrowser, TwoFactorBrowser):
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 @@ class BoursoramaBrowser(RetryLoginBrowser, TwoFactorBrowser):
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()
......
......@@ -28,7 +28,7 @@ from weboob.capabilities.bank import CapBankWealth, CapBankTransferAddRecipient,
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
......
......@@ -52,10 +52,6 @@ from weboob.tools.compat import urljoin, urlencode, urlparse, range
from weboob.exceptions import BrowserQuestion, BrowserIncorrectPassword, BrowserHTTPNotFound, BrowserUnavailable, ActionNeeded
class BrowserAuthenticationCodeMaxLimit(BrowserIncorrectPassword):
pass
class IncidentPage(HTMLPage):
pass
......@@ -89,8 +85,6 @@ class AuthenticationPage(HTMLPage):
"""
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()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment