Commit 5cab9c18 authored by Damien Mat's avatar Damien Mat Committed by Vincent A

[creditmutuel] Fix: Handle SafeTrans page

This page may appear just after login.
It is a 2FA method not handled yet.
The message will inform the user to switch to 'Confirmation Mobile',
which is an AppValidation method.
parent 8dfba9da
......@@ -59,7 +59,7 @@ from .pages import (
ConditionsPage, MobileConfirmationPage, UselessPage, DecoupledStatePage, CancelDecoupled,
OtpValidationPage, OtpBlockedErrorPage, TwoFAUnabledPage,
LoansOperationsPage, OutagePage, PorInvestmentsPage, PorHistoryPage, PorHistoryDetailsPage,
PorMarketOrdersPage, PorMarketOrderDetailsPage,
PorMarketOrdersPage, PorMarketOrderDetailsPage, SafeTransPage,
......@@ -86,6 +86,7 @@ class CreditMutuelBrowser(TwoFactorBrowser):
outage_page = URL(r'/fr/outage.html', OutagePage)
twofa_unabled_page = URL(r'/(?P<subbank>.*)fr/banque/validation.aspx', TwoFAUnabledPage)
mobile_confirmation = URL(r'/(?P<subbank>.*)fr/banque/validation.aspx', MobileConfirmationPage)
safetrans_page = URL(r'/(?P<subbank>.*)fr/banque/validation.aspx', SafeTransPage)
decoupled_state = URL(r'/fr/banque/async/otp/SOSD_OTP_GetTransactionState.htm', DecoupledStatePage)
cancel_decoupled = URL(r'/fr/banque/async/otp/SOSD_OTP_CancelTransaction.htm', CancelDecoupled)
otp_validation_page = URL(r'/(?P<subbank>.*)fr/banque/validation.aspx', OtpValidationPage)
......@@ -374,6 +375,10 @@ class CreditMutuelBrowser(TwoFactorBrowser):
assert self.polling_data, "Can't proceed to polling if no polling_data"
raise AppValidation(
if self.safetrans_page.is_here():
msg =
raise AuthMethodNotImplemented(msg)
if self.otp_validation_page.is_here():
self.otp_data =
assert self.otp_data, "Can't proceed to SMS handling if no otp_data"
......@@ -193,6 +193,23 @@ class MobileConfirmationPage(PartialHTMLPage, AppValidationPage):
self.logger.warning('This connexion cannot bypass mobile confirmation')
# PartialHTMLPage: this page shares URL with other pages,
# that might be empty of text while used in a redirection
class SafeTransPage(PartialHTMLPage, AppValidationPage):
# only 'class' and cryptic 'id' tags on this page
# so we scrape based on text, not tags
def is_here(self):
return (
'Authentification forte' in CleanText('//p[contains(@id, "title")]')(self.doc)
and CleanText('//*[contains(text(), "confirmer votre connexion avec Safetrans")]')(self.doc)
def get_safetrans_message(self):
return CleanText(
'//*[contains(text(), "Confirmation Mobile") or contains(text(), "confirmer votre connexion avec Safetrans")]'
class TwoFAUnabledPage(PartialHTMLPage):
def is_here(self):
return self.doc.xpath('//*[contains(text(), "aucun moyen pour confirmer")]')
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