Commit 50a28ee3 authored by Florian Duguet's avatar Florian Duguet Committed by Vincent A

[orange] move change_password detection in do_login

parent a3313374
......@@ -110,6 +110,10 @@ class OrangeBillBrowser(LoginBrowser, StatesMixin):
data = self.page.do_login_and_get_token(self.username, self.password)
self.password_page.go(json=data)
error_message = self.page.get_change_password_message()
if error_message:
raise BrowserPasswordExpired(error_message)
self.portal_page.go()
except ClientError as error:
......@@ -120,11 +124,6 @@ class OrangeBillBrowser(LoginBrowser, StatesMixin):
raise BrowserIncorrectPassword(error.response.json())
raise
if self.password_page.is_here():
error_message = self.page.get_change_password_message()
if error_message:
raise BrowserPasswordExpired(error_message)
def get_nb_remaining_free_sms(self):
raise NotImplementedError()
......
......@@ -47,6 +47,7 @@ class LoginPage(HTMLPage):
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
......
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