Commit 77c713b4 authored by Maxime Gasselin's avatar Maxime Gasselin Committed by Vincent A

[banquepopulaire] add new cases of login retry without phase parameter

Numerous wrongpass are still present. We let the retry to decide if we are
in a real wrongpass case.
parent 57fbd3d0
......@@ -382,6 +382,11 @@ class BanquePopulaire(LoginBrowser):
if self.need_relogin_before_redirect():
# Banque populaire now checks if the association login/phase parameter
# are well associated. Let's do login again without phase parameter
return self.do_login()'login')
validation_id =
......@@ -466,11 +471,16 @@ class BanquePopulaire(LoginBrowser):
WARNING: doing so can serves as a backdoor to avoid 2FA,
but we don't know for how long. Logger here to have a trace.
If 2FA still happens, it is catched in ''login')'
Moreover, for some users the phase paramater can't validate:
- In password request. Consequently we get the same state than login transaction request (Authentication)
- The login post leads to AUTHENTICATION_FAILED
redirect_data =
status =
if redirect_data and status == 'AUTHENTICATION_LOCKED':
assert not self.retry_login_without_phase, 'the login failed with and without phase 1 param' # avoid infinite loop at login
if self.retry_login_without_phase:
raise BrowserIncorrectPassword()
self.retry_login_without_phase = True
self.logger.warning("'AUTHENTICATION_LOCKED' status at first login, trying second login, whitout phase parameter")
......@@ -481,6 +491,7 @@ class BanquePopulaire(LoginBrowser):
if not redirect_data and
# assert to avoid infinite loop
assert not self.retry_login_without_phase, 'the login failed with and without phase 1 param'
self.retry_login_without_phase = True
return self.do_login()
......@@ -30,7 +30,7 @@ from PIL import Image, ImageFilter
from weboob.browser.elements import method, DictElement, ItemElement
from weboob.browser.filters.standard import (
CleanText, CleanDecimal, Regexp, Eval,
Date, Field, MapIn,
Date, Field, MapIn, Coalesce,
from weboob.browser.filters.html import Attr, Link, AttributeNotFound
from weboob.browser.filters.json import Dict
......@@ -376,6 +376,9 @@ class AuthenticationMethodPage(AbstractPage):
# We check here if we are doing a new login
return bool(Dict('step/phase/state', default=NotAvailable)(self.doc))
def get_status(self):
return Dict('response/status', default=NotAvailable)(self.doc)
class AuthenticationStepPage(AbstractPage):
PARENT = 'caissedepargne'
......@@ -383,7 +386,10 @@ class AuthenticationStepPage(AbstractPage):
BROWSER_ATTR = 'package.browser.CaisseEpargne'
def get_status(self):
return Dict('response/status', default=NotAvailable)(self.doc)
return Coalesce(
Dict('response/status', default=NotAvailable),
Dict('phase/state', default=NotAvailable)
class LoginPage(MyHTMLPage):
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