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

Commit 1a482b3

Browse files
authored
Merge pull request GuildEducationInc#44 from GuildEducationInc/redirect-issue-fix
Redirect issue fix
2 parents 8cd90d0 + 0258e85 commit 1a482b3

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

aws_jumpcloud/jumpcloud.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,16 @@ def _authenticate(self, otp=None):
5353
'X-Requested-With': 'XMLHttpRequest',
5454
'X-Xsrftoken': self._get_xsrf_token()}
5555
data = {"email": self.email, "password": self.password}
56+
5657
if otp is not None:
5758
data['otp'] = otp
58-
auth_resp = self.http.post("https://console.jumpcloud.com/userconsole/auth",
59-
headers=headers, json=data, allow_redirects=True,
60-
timeout=JumpCloudSession.HTTP_TIMEOUT)
59+
60+
auth_resp = self.http.post(
61+
"https://console.jumpcloud.com/userconsole/auth",
62+
headers=headers, json=data, allow_redirects=False,
63+
timeout=JumpCloudSession.HTTP_TIMEOUT
64+
)
65+
6166
if auth_resp.status_code == 200:
6267
self.logged_in = True
6368
Keyring().store_jumpcloud_timestamp(datetime.now(tz=timezone.utc))
@@ -82,7 +87,7 @@ def _auth_failure_exception(self, auth_resp, otp):
8287

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

8792
def _is_mfa_failure(self, auth_resp, otp):
8893
try:

0 commit comments

Comments
 (0)