Commit c99f5010 authored by Maxime Gasselin's avatar Maxime Gasselin Committed by Vincent A

[lcl] Handle BrowserPasswordExpired

parent f9ec5f03
......@@ -31,6 +31,7 @@ from dateutil.relativedelta import relativedelta
from weboob.exceptions import (
BrowserIncorrectPassword, BrowserUnavailable, BrowserQuestion,
AppValidation, AppValidationCancelled, AppValidationExpired,
BrowserPasswordExpired,
)
from weboob.browser import URL, need_login, TwoFactorBrowser
from weboob.browser.exceptions import ServerError, ClientError
......@@ -52,6 +53,7 @@ from .pages import (
Form2Page, DocumentsPage, ClientPage, SendTokenPage, CaliePage, ProfilePage, DepositPage,
AVHistoryPage, AVInvestmentsPage, CardsPage, AVListPage, CalieContractsPage, RedirectPage,
MarketOrdersPage, AVNotAuthorized, AVReroute, TwoFAPage, AuthentStatusPage, FinalizeTwoFAPage,
PasswordExpiredPage,
)
......@@ -69,7 +71,9 @@ class LCLBrowser(TwoFactorBrowser):
r'/outil/UAUT\?from=.*',
r'/outil/UWER/Accueil/majicER',
r'/outil/UWER/Enregistrement/forwardAcc',
LoginPage)
LoginPage
)
password_expired_page = URL(r'/outil/UWMC/NoConnect/incitationChangementMdp', PasswordExpiredPage)
redirect_page = URL(r'/outil/UAUT/Accueil/preRoutageLogin', RedirectPage)
contracts_page = URL(
r'/outil/UAUT/Contrat/choixContrat.*',
......@@ -261,6 +265,9 @@ class LCLBrowser(TwoFactorBrowser):
if self.login.is_here():
self.page.check_error()
if self.password_expired_page.is_here():
raise BrowserPasswordExpired(self.page.get_message())
if (not self.contracts and not self.parsed_contracts
and (self.contracts_choice.is_here() or self.contracts_page.is_here())):
# On the preRoutageLogin page we gather the list of available contracts for this account
......
......@@ -233,6 +233,11 @@ class ContractsPage(LoginPage, PartialHTMLPage):
form.submit()
class PasswordExpiredPage(LoggedPage, HTMLPage):
def get_message(self):
return CleanText('//form[@id="changementCodeForm"]//span[contains(., "nouveau code d’accès")]')(self.doc)
class ContractsChoicePage(ContractsPage):
def on_load(self):
self.check_error()
......
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