From 201451763d8f81609d33323712ab5e6243229704 Mon Sep 17 00:00:00 2001 From: Martin Lavoie Date: Wed, 2 Jun 2021 11:26:26 +0200 Subject: [PATCH] [orange] Update the handling of expired password I hardcode the message since it is not in the response anymore. --- modules/orange/pages/login.py | 29 +++-------------------------- 1 file changed, 3 insertions(+), 26 deletions(-) diff --git a/modules/orange/pages/login.py b/modules/orange/pages/login.py index b706503d34..8747854473 100644 --- a/modules/orange/pages/login.py +++ b/modules/orange/pages/login.py @@ -19,10 +19,6 @@ from __future__ import unicode_literals -import lxml.html as html - -from io import StringIO - from woob.browser.pages import HTMLPage, LoggedPage, JsonPage, RawPage from woob.browser.filters.standard import CleanText, Format @@ -34,28 +30,9 @@ class LoginPage(RawPage): class PasswordPage(JsonPage): ENCODING = 'utf-8' def get_change_password_message(self): - if self.doc.get('stage') != 'changePassword': - # when stage is not present everything is okay, and if it's not changePassword we prefer do nothing here - return - - if 'mandatory' not in self.doc['options']: - # maybe there are some cases where it's optional - return - - encoding = self.encoding - if encoding == 'latin-1': - encoding = 'latin1' - if encoding: - encoding = encoding.replace('ISO8859_', 'ISO8859-') - - parser = html.HTMLParser(encoding=encoding) - html_doc = html.parse(StringIO(self.doc['view']), parser) - - # message should be: - # Votre mot de passe actuel n’est pas suffisamment sécurisé et doit être renforcé. - # Veuillez le modifier pour accéder à vos services Orange. - return CleanText('//p[@id="cnMsg"]')(html_doc) - + if self.doc.get('step') == 'mandatory': + # The password expired message on the website is fetched from a javascript file. + return 'Votre mot de passe actuel n’est pas suffisamment sécurisé et doit être renforcé.' class ManageCGI(HTMLPage): pass -- GitLab