From bd67ef24a5299cdb67d857d8f38004e063db3a7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Sobucki?= Date: Tue, 18 May 2021 11:16:40 +0200 Subject: [PATCH] [hsbc] Handle relogin after otp validation In some scenarios, relogin are triggered. If it happens inside `handle_otp`, the otp value stored in config will not be cleared. The consequence is that we will try to validate the otp once again, even though we might not even be on the right page. To fix that we reset the otp value to its default value manually. --- modules/hsbc/browser.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/modules/hsbc/browser.py b/modules/hsbc/browser.py index 980ff0586a..7f240ac348 100644 --- a/modules/hsbc/browser.py +++ b/modules/hsbc/browser.py @@ -170,6 +170,12 @@ def load_state(self, state): def handle_otp(self): otp = self.config['otp'].get() + + # In some scenarios relogin will be triggered (see AppGonePage). + # We need to set config['otp'] to None, otherwise we will try to validate + # the otp once again even though we might not be on the right page anymore. + self.config['otp'].set(self.config['otp'].default) + self.page.login_with_secure_key(self.secret, otp) self.end_login() -- GitLab