Commit 05824e24 authored by Jerome Berthier's avatar Jerome Berthier Committed by Vincent A

[banquepopulaire] rework previous patch, raise BrowserIncorrectPassword only in a specific case

The current source code leads to false positive BrowserIncorrectPassword.
Some accounts got an exception when fetching history or cards coming,
which is correctly handled by the module using ErrorPage.

This patch restricts the BrowserIncorrectPassword 'hack' to the login stage, as
it is the only case we want to catch.
parent 802516aa
......@@ -187,10 +187,6 @@ class BanquePopulaire(LoginBrowser): = {}
# HACK, the website may crash with legacy passwords (legacy means not only digits)
# If the website crashes and if we have a legacy password, we raise WrongPass instead of BrowserUnavailable
self.is_password_only_digits = None
def deinit(self):
super(BanquePopulaire, self).deinit()
......@@ -218,9 +214,17 @@ class BanquePopulaire(LoginBrowser):
if self.home_page.is_here():
self.is_password_only_digits = self.password.isdigit()
try:, self.password)
except BrowserUnavailable as ex:
# HACK: some accounts with legacy password fails (legacy means not only digits).
# The website crashes, even on a web browser.
# So, if we get a specific exception AND if we have a legacy password,
# we raise WrongPass instead of BrowserUnavailable.
if 'Cette page est indisponible' in ex.message and not self.password.isdigit():
raise BrowserIncorrectPassword()
raise, self.password)
if self.login_page.is_here():
raise BrowserIncorrectPassword()
if 'internetRescuePortal' in self.url:
......@@ -271,10 +271,6 @@ class RedirectPage(LoggedPage, MyHTMLPage):
class ErrorPage(LoggedPage, MyHTMLPage):
def on_load(self):
# HACK: some accounts with legacy password fails, people needs to update it
if not self.browser.is_password_only_digits:
raise BrowserIncorrectPassword()
if CleanText('//script[contains(text(), "momentanément indisponible")]')(self.doc):
raise BrowserUnavailable(u"Le service est momentanément indisponible")
elif CleanText('//h1[contains(text(), "Cette page est indisponible")]')(self.doc):
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