Commit 8444c044 authored by Célande Adrien's avatar Célande Adrien Committed by Romain Bignon

[banquepopulaire] wrong catching of the login page

When the user is already logged in and it tries to log anyway, the website response by a json page which says it.
But sometimes, this page may be catch by the Login2Page because of the URL.

So now, the page exist with a is_here to be sure.

Closes: 16413@sibi
Closes: 16408@sibi
Closes: 17916@sibi
Closes: 10663@sibi
Closes: 13746@sibi
Closes: 10622@sibi
Closes: 16474@sibi
Closes: 15877@sibi
Closes: 16473@sibi
Closes: 17884@sibi
Closes: 18531@sibi
Closes: 15851@sibi
parent 04be5f39
......@@ -37,7 +37,7 @@ from .pages import (
IbanPage, AdvisorPage, TransactionDetailPage, TransactionsBackPage,
NatixisPage, EtnaPage, NatixisInvestPage, NatixisHistoryPage, NatixisErrorPage,
NatixisDetailsPage, NatixisChoicePage, NatixisRedirect,
LineboursePage,
LineboursePage, AlreadyLoginPage,
)
from .linebourse_browser import LinebourseBrowser
......@@ -140,6 +140,8 @@ class BanquePopulaire(LoginBrowser):
r'https://[^/]+/cyber/internet/ShowPortal.do\?token=.*',
HomePage)
already_login_page = URL(r'https://[^/]+/dacswebssoissuer.*',
r'https://[^/]+/WebSSO_BP/_(?P<bankid>\d+)/index.html\?transactionID=(?P<transactionID>.*)', AlreadyLoginPage)
login2_page = URL(r'https://[^/]+/WebSSO_BP/_(?P<bankid>\d+)/index.html\?transactionID=(?P<transactionID>.*)', Login2Page)
# natixis
......
......@@ -359,6 +359,19 @@ class Login2Page(LoginPage):
self.browser.location(doc['response']['saml2_post']['action'], data=data)
class AlreadyLoginPage(LoggedPage, MyHTMLPage):
def is_here(self):
try:
doc = json.loads(self.response.text)
if 'response' in doc:
return doc['response']['status'] == 'AUTHENTICATION_SUCCESS' and 'saml2_post' in doc['response']
except json.decoder.JSONDecodeError:
# not a json page
# so it should be Login2Page
return False
return False
class IndexPage(LoggedPage, MyHTMLPage):
def get_token(self):
url = self.doc.xpath('//frame[@name="portalHeader"]')[0].attrib['src']
......
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