Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
weboob
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
183
Issues
183
List
Boards
Labels
Milestones
Merge Requests
52
Merge Requests
52
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
weboob
weboob
Commits
c2743eaf
Commit
c2743eaf
authored
Feb 09, 2021
by
Damien Mat
Committed by
Vincent A
Feb 12, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[bp] More robust 2FA messages handling
parent
3b899aa7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
11 deletions
+13
-11
modules/bp/browser.py
modules/bp/browser.py
+3
-1
modules/bp/pages/login.py
modules/bp/pages/login.py
+10
-10
No files found.
modules/bp/browser.py
View file @
c2743eaf
...
...
@@ -491,7 +491,9 @@ def do_login(self):
raise
BrowserQuestion
(
Value
(
'code'
,
label
=
'Entrez le code reçu par SMS'
))
elif
auth_method
==
'no2fa'
:
self
.
location
(
self
.
page
.
get_skip_url
())
skip_twofa_url
=
self
.
page
.
get_skip_twofa_url
()
assert
skip_twofa_url
,
'No url found to skip 2FA'
self
.
location
(
skip_twofa_url
)
# If we are here, we don't need 2FA, we are logged
...
...
modules/bp/pages/login.py
View file @
c2743eaf
...
...
@@ -162,6 +162,12 @@ def on_load(self):
def
get_auth_method
(
self
):
status_message
=
CleanText
(
'//div[@class="textFCK"]'
)(
self
.
doc
)
if
re
.
search
(
'avez pas de solution d’authentification forte'
+
"|avez pas encore activé votre service gratuit d'authentification forte"
,
status_message
):
return
'no2fa'
elif
re
.
search
(
'Une authentification forte via Certicode Plus vous'
+
'|vous rendre sur l’application mobile La Banque Postale'
,
status_message
...
...
@@ -173,12 +179,6 @@ def get_auth_method(self):
status_message
):
return
'cer'
elif
re
.
search
(
'avez pas de solution d’authentification forte'
+
"|avez pas encore activé votre service gratuit d'authentification forte"
,
status_message
):
return
'no2fa'
elif
(
'Nous rencontrons un problème pour valider votre opération. Veuillez reessayer plus tard'
in
status_message
...
...
@@ -190,18 +190,18 @@ def get_auth_method(self):
):
# Only first sentence explains 'why', the rest is 'how'
short_message
=
CleanText
(
'(//div[@class="textFCK"])[1]//p[1]'
)(
self
.
doc
)
url
=
self
.
get_skip_url
(
)
url
=
Link
(
'//div[@class="certicode_footer"]/a'
)(
self
.
doc
)
if
not
url
:
raise
ActionNeeded
(
"Une authentification forte est requise sur votre espace client :
%
s"
%
short_message
)
else
:
# raise an error to avoid silencing other no2fa
cas
es
# raise an error to avoid silencing other no2fa
/2fa messag
es
raise
AssertionError
(
"No 2FA case to skip, or new 2FA case to trigger"
)
raise
AssertionError
(
'Unhandled login message: "
%
s"'
%
status_message
)
def
get_skip_url
(
self
):
return
Link
(
'//div[@class="certicode_footer"]/a
'
)(
self
.
doc
)
def
get_skip_
twofa_
url
(
self
):
return
Link
(
'//div[@class="certicode_footer"]/a
[contains(text(), "Poursuivre")]'
,
default
=
None
)(
self
.
doc
)
class
Validated2FAPage
(
MyHTMLPage
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment