Commit 7c30bb26 authored by Ludovic LANGE's avatar Ludovic LANGE Committed by Vincent A

[edfparticulier] fix authentication

Authentication seems to have changed (#453), and in fact a few changes are needed
to make it work again:
* A new js page is now the target of the initial redirection chain,
* This page gives us a new parameter ('goto') which is needed by the authenticate
* and old cookies need to be cleared before the authenticate call (otherwise an error
is thrown)
parent c99f5010
......@@ -31,7 +31,7 @@ from import Value
from .pages import (
HomePage, AuthenticatePage, AuthorizePage, WrongPasswordPage, CheckAuthenticatePage, ProfilPage,
DocumentsPage, WelcomePage, UnLoggedPage, ProfilePage, BillDownload,
DocumentsPage, WelcomePage, UnLoggedPage, ProfilePage, BillDownload, XUIPage,
......@@ -43,6 +43,7 @@ class EdfParticulierBrowser(LoginBrowser, StatesMixin):
home = URL('/fr/accueil/contrat-et-conso/mon-compte-edf.html', HomePage)
xuipage = URL(r'<realm>.*)&goto=(?P<goto>.*)', XUIPage)
authenticate = URL(r'', AuthenticatePage)
authorize = URL(r'', AuthorizePage)
wrong_password = URL(
......@@ -108,7 +109,13 @@ class EdfParticulierBrowser(LoginBrowser, StatesMixin):'already logged')
self.authenticate.go(method='POST', params=auth_params)
if not self.xuipage.is_here():
raise AssertionError('Wrong workflow - authentication has changed, please report error')
auth_params['goto'] ='goto', '')
self.authenticate.go(method='POST', params=auth_params, data='')
data =
data['callbacks'][0]['input'][0]['value'] = self.username
......@@ -38,6 +38,10 @@ class HomePage(HTMLPage):
class XUIPage(HTMLPage):
class AuthenticatePage(JsonPage):
def has_captcha_request(self):
return self.doc['stage'] == "RecaptchaModuleS1"
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