diff --git a/modules/ing/api/login.py b/modules/ing/api/login.py index 4a27be0af967da5baf2fab216d433893a769945a..11cf9766077489f4c6b83e32431b78937b657039 100644 --- a/modules/ing/api/login.py +++ b/modules/ing/api/login.py @@ -41,6 +41,10 @@ def init_vk(self, img, password): # pin positions (website side) start at 1, our positions start at 0 return [password_random_coords[index - 1] for index in pin_position] + def has_strong_authentication(self): + # If this value is at False, this mean there is an OTP needed to login + return not Dict('strongAuthenticationLoginExempted')(self.doc) + def get_password_coord(self, img, password): assert 'pinPositions' in self.doc, 'Virtualkeyboard position has failed' assert 'keyPadUrl' in self.doc, 'Virtualkeyboard image url is missing' diff --git a/modules/ing/api_browser.py b/modules/ing/api_browser.py index cbc8fe97c12a38f7a3b86e2624a20614d3e8e7fe..cee8f665d8d95bb820d48c9b5ad054df66a97c84 100644 --- a/modules/ing/api_browser.py +++ b/modules/ing/api_browser.py @@ -203,9 +203,12 @@ def do_login(self): except ClientError as e: self.handle_login_error(e) - self.auth_token = self.page.response.headers['Ingdf-Auth-Token'] - self.session.headers['Ingdf-Auth-Token'] = self.auth_token - self.session.cookies['ingdfAuthToken'] = self.auth_token + if not self.page.has_strong_authentication(): + self.auth_token = self.page.response.headers['Ingdf-Auth-Token'] + self.session.headers['Ingdf-Auth-Token'] = self.auth_token + self.session.cookies['ingdfAuthToken'] = self.auth_token + else: + raise ActionNeeded("Vous devez réaliser la double authentification sur le portail internet") # to be on logged page, to avoid relogin self.accounts.go()