diff --git a/modules/banquepopulaire/browser.py b/modules/banquepopulaire/browser.py index dd93b647422f4c749f20314d01c10b07b54dd05b..11261dd7f3935c1787c6b7ccee6399a3b40ac255 100644 --- a/modules/banquepopulaire/browser.py +++ b/modules/banquepopulaire/browser.py @@ -187,6 +187,10 @@ def __init__(self, website, *args, **kwargs): self.investments = {} + # 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() self.linebourse.deinit() @@ -213,6 +217,9 @@ def do_login(self): # avoids trying to relog in while it's already on home page if self.home_page.is_here(): return + + self.is_password_only_digits = self.password.isdigit() + self.page.login(self.username, self.password) if self.login_page.is_here(): raise BrowserIncorrectPassword() diff --git a/modules/banquepopulaire/pages.py b/modules/banquepopulaire/pages.py index 9186fc040c65fe46b1c3fcb56ffc06bd9bcb6c87..afa9ef4e52e9512bac76c5c0914f33c0396b0caa 100644 --- a/modules/banquepopulaire/pages.py +++ b/modules/banquepopulaire/pages.py @@ -271,6 +271,10 @@ def on_load(self): 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):