Commit e1ff565a authored by Jerome Berthier's avatar Jerome Berthier Committed by ntome

[banquepopulaire] do not raise BrowserIncorrectPassword with legacy passwords

It still works for some people, so instead of raising an error, we wait
for the website to crash then we raise a BrowserIncorrectPassword if
it uses a legacy password.
parent 9c1b5941
Pipeline #2388 created with stages
......@@ -187,6 +187,10 @@ class BanquePopulaire(LoginBrowser):
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 @@ class BanquePopulaire(LoginBrowser):
# 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()
......
......@@ -271,6 +271,10 @@ 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