Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handles case of grace period for registering MFA #97

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions roadtx/roadtools/roadtx/selenium.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,16 @@ def selenium_login(self, url, identity=None, password=None, otpseed=None, keep=F
els = WebDriverWait(driver, 6000).until(lambda d: d.find_element(By.ID, "i0118"))
els.send_keys(Keys.ENTER)

try:
# handle case with "Action Required"
# happens when user is not registered with MFA yet and has XX days until required
els = WebDriverWait(driver, 2).until(lambda d: d.find_element(By.ID, 'txtSkipMfaRegistration'))
print(f"MFA will be enforced for this account: {els.text} (skipping now)")
els = WebDriverWait(driver, 2).until(lambda d: d.find_element(By.ID, 'btnAskLater'))
els.click()
except TimeoutException:
pass

# Quick check of mfa not needed
try:
WebDriverWait(driver, 2).until(lambda d: '?code=' in d.current_url)
Expand Down