bnporc better handle of expired password

This commit is contained in:
Baptiste Delpey 2015-08-17 15:25:27 +02:00 committed by Romain Bignon
commit e0a57153ed
2 changed files with 6 additions and 6 deletions

View file

@ -24,7 +24,6 @@ from weboob.browser import LoginBrowser, URL, need_login
from weboob.capabilities.base import find_object from weboob.capabilities.base import find_object
from weboob.capabilities.bank import AccountNotFound from weboob.capabilities.bank import AccountNotFound
from weboob.tools.json import json from weboob.tools.json import json
from weboob.exceptions import BrowserPasswordExpired
from .pages import LoginPage, AccountsPage, AccountsIBANPage, HistoryPage, TransferInitPage, ConnectionThresholdPage from .pages import LoginPage, AccountsPage, AccountsIBANPage, HistoryPage, TransferInitPage, ConnectionThresholdPage
@ -69,7 +68,9 @@ class BNPParibasBrowser(CompatMixin, JsonBrowserMixin, LoginBrowser):
'https://mabanqueprivee.bnpparibas.net/fr/espace-prive/comptes-et-contrats\?u=%2FSEEA-pa01%2FdevServer%2Fseeaserver', 'https://mabanqueprivee.bnpparibas.net/fr/espace-prive/comptes-et-contrats\?u=%2FSEEA-pa01%2FdevServer%2Fseeaserver',
LoginPage) LoginPage)
con_threshold = URL('/fr/connexion/100-connexions', con_threshold = URL('/fr/connexion/100-connexions',
'/fr/espace-prive/100-connexions.*', ConnectionThresholdPage) '/fr/espace-prive/100-connexions.*',
'/fr/espace-pro/100-connexions-pro.*',
'/fr/systeme/page-indisponible', ConnectionThresholdPage)
accounts = URL('udc-wspl/rest/getlstcpt', AccountsPage) accounts = URL('udc-wspl/rest/getlstcpt', AccountsPage)
ibans = URL('rib-wspl/rpc/comptes', AccountsIBANPage) ibans = URL('rib-wspl/rpc/comptes', AccountsIBANPage)
history = URL('rop-wspl/rest/releveOp', HistoryPage) history = URL('rop-wspl/rest/releveOp', HistoryPage)
@ -91,8 +92,6 @@ class BNPParibasBrowser(CompatMixin, JsonBrowserMixin, LoginBrowser):
self.login.go(timestamp=timestamp()) self.login.go(timestamp=timestamp())
if self.login.is_here(): if self.login.is_here():
self.page.login(self.username, self.password) self.page.login(self.username, self.password)
if self.con_threshold.is_here():
raise BrowserPasswordExpired(u'Vous avez atteint le seuil de 100 connexions avec le même code secret. Par mesure de sécurité, veuillez le changer.')
@need_login @need_login
def get_accounts_list(self): def get_accounts_list(self):

View file

@ -27,13 +27,14 @@ from weboob.browser.pages import JsonPage, LoggedPage, HTMLPage
from weboob.tools.captcha.virtkeyboard import GridVirtKeyboard from weboob.tools.captcha.virtkeyboard import GridVirtKeyboard
from weboob.capabilities.bank import Account from weboob.capabilities.bank import Account
from weboob.tools.capabilities.bank.transactions import FrenchTransaction from weboob.tools.capabilities.bank.transactions import FrenchTransaction
from weboob.exceptions import BrowserIncorrectPassword, BrowserUnavailable from weboob.exceptions import BrowserIncorrectPassword, BrowserUnavailable, BrowserPasswordExpired
from weboob.tools.json import json from weboob.tools.json import json
from weboob.tools.date import parse_french_date as Date from weboob.tools.date import parse_french_date as Date
class ConnectionThresholdPage(HTMLPage): class ConnectionThresholdPage(HTMLPage):
pass def on_load(self):
raise BrowserPasswordExpired(u'Vous avez atteint le seuil de 100 connexions avec le même code secret. Par mesure de sécurité, veuillez le changer.')
def cast(x, typ, default=None): def cast(x, typ, default=None):
try: try: