From 9fcdb89a15702eac95f7017b4bb6c31a5c46fd6b Mon Sep 17 00:00:00 2001 From: Guillaume Risbourg Date: Mon, 8 Jun 2020 17:46:01 +0200 Subject: [PATCH] [bnporc] Fix expired password change After modifiying the password, there is a call to another URL that is done by the website to validate the password change. The message returned by the json can variate, so we need to check if there is an error based on the statut returned, not the error message. --- modules/bnporc/pp/browser.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/bnporc/pp/browser.py b/modules/bnporc/pp/browser.py index ad9dc6a5e1..35bc103c91 100644 --- a/modules/bnporc/pp/browser.py +++ b/modules/bnporc/pp/browser.py @@ -176,8 +176,11 @@ def change_pass(self, oldpass, newpass): data['nouveauPassword'] = vk.get_string_code(newpass) data['passwordActuel'] = vk.get_string_code(oldpass) response = self.location('/mcs-wspl/rpc/modifiercodesecret', data=data) - if response.json().get('messageIden').lower() == 'nouveau mot de passe invalide': + statut = response.json().get('statut') + self.logger.warning('Password change response : statut="%s" - message="%s"', statut, response.json().get('messageIden')) + if statut != '1': return False + self.location('/mcs-wspl/rpc/validercodesecret') return True @need_login -- GitLab