From 175c1fca3feab7087be351c548edab448a0d2eeb Mon Sep 17 00:00:00 2001 From: Jerome Berthier Date: Mon, 8 Apr 2019 14:07:21 +0200 Subject: [PATCH] [creditdunord] Handle a new BrowserPasswordExpired message There is no message within the redirection page, so we need to reach the EntryPage to check whether this message exists. --- modules/creditdunord/browser.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/modules/creditdunord/browser.py b/modules/creditdunord/browser.py index 5d8d941c36..da20f469c4 100644 --- a/modules/creditdunord/browser.py +++ b/modules/creditdunord/browser.py @@ -83,9 +83,18 @@ def do_login(self): if not self.logged: raise BrowserIncorrectPassword() + # The redirection page may contain a message if self.page.doc.xpath('//head[title="Authentification"]/script[contains(text(), "_pageLabel=reinitialisation_mot_de_passe")]'): raise BrowserPasswordExpired() + if not self.entrypage.is_here(): + self.entrypage.go() + + # The main page may contain a message as well + msg = 'vous devez modifier votre code confidentiel à la première connexion puis tous les 12 mois' + if self.page.doc.xpath('//b[contains(text(), "%s")]' % msg): + raise BrowserPasswordExpired(msg.capitalize()) + def _iter_accounts(self): self.loans.go(account_type=self.account_type, loans_page_label=self.loans_page_label) for a in self.page.get_list(): -- GitLab