Commit c5a79d02 authored by Florian Duguet's avatar Florian Duguet Committed by Romain Bignon

[edf] - par - fix login by correctly handling captcha

they have added another way to login with otp, by sms or email
otp is just the first time we login, and to manage it we would have to store session in StatesMixin
but it's not mandatory, we still can continue to use recaptcha google and edf won't ask us otp

Closes: 36486@sibi
parent d817fd74
......@@ -92,10 +92,8 @@ class EdfBrowser(LoginBrowser):
"""
self.check_authenticate.go()
else:
self.home.go()
self.authenticate.go(method='POST', params=auth_params)
if self.page.has_captcha_request():
# google recaptcha site key is returned here, but it's not a good one, take it from another url
self.authenticate.go(method='POST', params=auth_params)
data = self.page.get_data()
website_key = data['callbacks'][4]['output'][0]['value']
website_url = "https://espace-client.edf.fr/sso/XUI/#login/&realm=%2FINTERNET"
......
......@@ -33,11 +33,13 @@ from weboob.capabilities.profile import Profile
class HomePage(HTMLPage):
def has_captcha_request(self):
return len(self.doc.xpath('//div[@class="captcha"]')) > 0
pass
class AuthenticatePage(JsonPage):
def has_captcha_request(self):
return self.doc['stage'] == "RecaptchaModuleS1"
def get_data(self):
return self.doc
......
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