Skip to content
This repository has been archived by the owner on Nov 2, 2022. It is now read-only.

Commit

Permalink
Merge pull request #45 from GuildEducationInc/beta
Browse files Browse the repository at this point in the history
Fixing MFA missing issue
  • Loading branch information
javs-perez authored Sep 30, 2020
2 parents 8cd90d0 + 8cf4307 commit d2a9bb8
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ If you're running macOS but don't have Python 3, I recommend installing it with

To install `aws-jumpcloud` itself, just point `pip3` at the latest GitHub release:
```bash
$ pip3 install https://github.com/GuildEducationInc/aws-jumpcloud/archive/2.1.6.tar.gz
$ pip3 install https://github.com/GuildEducationInc/aws-jumpcloud/archive/2.1.7.tar.gz
```

### Migrating from `~/.aws` credentials
Expand Down
13 changes: 9 additions & 4 deletions aws_jumpcloud/jumpcloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,16 @@ def _authenticate(self, otp=None):
'X-Requested-With': 'XMLHttpRequest',
'X-Xsrftoken': self._get_xsrf_token()}
data = {"email": self.email, "password": self.password}

if otp is not None:
data['otp'] = otp
auth_resp = self.http.post("https://console.jumpcloud.com/userconsole/auth",
headers=headers, json=data, allow_redirects=True,
timeout=JumpCloudSession.HTTP_TIMEOUT)

auth_resp = self.http.post(
"https://console.jumpcloud.com/userconsole/auth",
headers=headers, json=data, allow_redirects=False,
timeout=JumpCloudSession.HTTP_TIMEOUT
)

if auth_resp.status_code == 200:
self.logged_in = True
Keyring().store_jumpcloud_timestamp(datetime.now(tz=timezone.utc))
Expand All @@ -82,7 +87,7 @@ def _auth_failure_exception(self, auth_resp, otp):

def _is_mfa_missing(self, auth_resp, otp):
return auth_resp.status_code == 302 and otp is None and \
"error=4014" in auth_resp.headers['Location']
"/login" in auth_resp.headers['Location']

def _is_mfa_failure(self, auth_resp, otp):
try:
Expand Down
2 changes: 1 addition & 1 deletion aws_jumpcloud/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__VERSION__ = "2.1.6"
__VERSION__ = "2.1.7"

0 comments on commit d2a9bb8

Please sign in to comment.