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
e8e03c49
Commit
e8e03c49
authored
Feb 02, 2021
by
thibault douge
Committed by
Vincent A
Feb 12, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[amazon] handle form when we have different device choice
parent
93bc1805
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
2 deletions
+12
-2
modules/amazon/browser.py
modules/amazon/browser.py
+2
-2
modules/amazon/pages.py
modules/amazon/pages.py
+10
-0
No files found.
modules/amazon/browser.py
View file @
e8e03c49
...
...
@@ -95,7 +95,7 @@ def locate_browser(self, state):
self
.
location
(
state
[
'url'
])
def
check_interactive
(
self
):
if
not
self
.
config
[
'request_information'
]
.
get
()
:
if
self
.
config
[
'request_information'
]
.
get
()
is
None
:
raise
NeedInteractiveFor2FA
()
def
send_notification_interactive_mode
(
self
):
...
...
@@ -131,7 +131,7 @@ def handle_security(self):
# we don't raise an error because for the seller account 2FA is mandatory
self
.
logger
.
warning
(
'2FA is enabled, all connections send an OTP'
)
if
self
.
page
.
has_form_verify
()
or
self
.
page
.
has_form_auth_mfa
():
if
self
.
page
.
has_form_verify
()
or
self
.
page
.
has_form_auth_mfa
()
or
self
.
page
.
has_form_select_device
()
:
self
.
check_interactive
()
self
.
page
.
send_code
()
captcha
=
self
.
page
.
get_captcha_url
()
...
...
modules/amazon/pages.py
View file @
e8e03c49
...
...
@@ -47,6 +47,8 @@ def get_sub_link(self):
class
SecurityPage
(
HTMLPage
):
def
get_otp_type
(
self
):
if
self
.
doc
.
xpath
(
'//form[@id="auth-select-device-form"]'
):
return
'auth-select-device-form'
# amazon send us otp in two cases:
# - if it's the first time we connect to this account for an ip => manage it normally
# - if user has activated otp in his options => raise ActionNeeded, an ask user to deactivate it
...
...
@@ -63,6 +65,11 @@ def get_otp_message(self):
def
send_code
(
self
):
form
=
self
.
get_form
()
if
form
.
el
.
attrib
.
get
(
'id'
)
==
'auth-select-device-form'
:
# the first is sms, second email, third application
# the first item is automatically selected
form
.
submit
()
if
form
.
el
.
attrib
.
get
(
'id'
)
==
'auth-mfa-form'
:
# when code is sent by sms, server send it automatically, nothing to do here
return
...
...
@@ -95,6 +102,9 @@ def has_form_verify(self):
def
has_form_auth_mfa
(
self
):
return
bool
(
self
.
doc
.
xpath
(
'//form[@id="auth-mfa-form"]'
))
def
has_form_select_device
(
self
):
return
bool
(
self
.
doc
.
xpath
(
'//form[@id="auth-select-device-form"]'
))
class
ApprovalPage
(
HTMLPage
,
LoggedPage
):
def
get_msg_app_validation
(
self
):
...
...
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