Commit 92bb56c0 authored by Ilyas Semmaoui's avatar Ilyas Semmaoui Committed by Vincent A

[lcl] fix crash with incomplete redirection from external websites

The redirection from life insurance or bourse websites to the base account was
missing one step to complete and thus creating issues while trying to access to
the accounts since after failing the redirection we are logged out
parent f3f020cc
......@@ -53,7 +53,7 @@
Form2Page, DocumentsPage, ClientPage, SendTokenPage, CaliePage, ProfilePage, DepositPage,
AVHistoryPage, AVInvestmentsPage, CardsPage, AVListPage, CalieContractsPage, RedirectPage,
MarketOrdersPage, AVNotAuthorized, AVReroute, TwoFAPage, AuthentStatusPage, FinalizeTwoFAPage,
PasswordExpiredPage, ContractRedirectionPage,
......@@ -80,8 +80,8 @@ class LCLBrowser(TwoFactorBrowser):
contract_redirection_page = URL(r'/outil/UAUT/Contract/redirection', ContractRedirectionPage)
contracts_choice = URL(r'.*outil/UAUT/Contract/routing', ContractsChoicePage)
home = URL(r'/outil/UWHO/Accueil/', HomePage)
accounts = URL(r'/outil/UWSP/Synthese', AccountsPage)
......@@ -268,8 +268,11 @@ def init_login(self):
if self.password_expired_page.is_here():
raise BrowserPasswordExpired(
if (not self.contracts and not self.parsed_contracts
and (self.contracts_choice.is_here() or self.contracts_page.is_here())):
if (
not self.contracts and not self.parsed_contracts
and (self.contracts_choice.is_here() or self.contracts_page.is_here()
or self.contract_redirection_page.is_here())
# On the preRoutageLogin page we gather the list of available contracts for this account
self.contracts =
# If there is not multiple contracts then self.contracts will be empty
......@@ -357,6 +360,8 @@ def connexion_bourse(self):
def deconnexion_bourse(self):
if self.contract_redirection_page.is_here() and
if self.login.is_here():
# When we logout we can be disconnected from the main site
......@@ -385,6 +390,8 @@ def update_life_insurance_account(self, life_insurance):
def go_back_from_life_insurance_website(self):
if self.contract_redirection_page.is_here() and
def select_contract(self, id_contract):
if self.current_contract and id_contract != self.current_contract:
......@@ -228,6 +228,15 @@ def select_contract(self, id_contract=None):
class ContractRedirectionPage(ContractsPage):
def should_submit_redirect_form(self):
return bool(self.doc.xpath('//body[contains(@onload, "envoyerJeton()")]/form'))
def submit_redirect_form(self):
form = self.get_form(id='form')
class PasswordExpiredPage(LoggedPage, HTMLPage):
def get_message(self):
return CleanText('//form[@id="changementCodeForm"]//span[contains(., "nouveau code d’accès")]')(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