Commit 415f2317 authored by Lucas Ficheux's avatar Lucas Ficheux Committed by Vincent A

[caissedepargne] Raise BrowserPasswordExpired

The module did not handle the case when a user needs to
renew their password so it crashed.

This commit fixes that by checking for a key in the json responses of
parent 3eafe21b
......@@ -55,6 +55,7 @@ from import SplitKeyboard, GridVirtKeyboard
from import unicode
from weboob.exceptions import (
NoAccountsException, BrowserUnavailable, ActionNeeded, BrowserIncorrectPassword,
from weboob.browser.filters.json import Dict
from weboob.browser.exceptions import ClientError
......@@ -121,7 +122,11 @@ class AuthenticationMethodPage(JsonPage):
def validation_units(self):
return Dict('step/validationUnits')(self.doc)[0]
units = Coalesce(
Dict('step/validationUnits', default=None),
Dict('validationUnits', default=None),
return units[0]
def validation_unit_id(self):
......@@ -142,6 +147,8 @@ class AuthenticationMethodPage(JsonPage):
# So it does not require any action from the user and is automatic.
raise BrowserIncorrectPassword()
if error in ('ENROLLMENT', ):
raise BrowserPasswordExpired()
def transfer_errors(self, error):
......@@ -163,6 +170,8 @@ class AuthenticationMethodPage(JsonPage):
# error will be handle in `if` case.
# If there is no error, it will retrive 'AUTHENTICATION' as result value.
result = self.doc['step']['phase']['state']
elif 'phase' in self.doc and self.get_authentication_method_type() == 'PASSWORD_ENROLL':
result = self.doc['phase']['state']
result = self.doc['phase']['previousResult']
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