-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Functions Name refactoring + removing docstrings
- Loading branch information
Showing
15 changed files
with
232 additions
and
596 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +0,0 @@ | ||
from .base import status, names, uuid, uuids | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
from ...error.exceptions import * | ||
from ...utils import web | ||
from ..urls import SECURITY_CHALLENGES, SECURITY_CHECK | ||
|
||
|
||
def is_user_ip_secure(access_token: str) -> bool: | ||
try: | ||
headers = web.get_auth_header(access_token) | ||
web.request('get', SECURITY_CHECK, exceptions=(PayloadError, Unauthorized, IPNotSecured), headers=headers) | ||
except IPNotSecured: | ||
return False | ||
else: | ||
return True | ||
|
||
def get_user_challenges(access_token: str) -> list: | ||
headers = web.get_auth_header(access_token) | ||
data = web.request('get', SECURITY_CHALLENGES, exceptions=(PayloadError, Unauthorized), headers=headers) | ||
return data | ||
|
||
def verify_user_ip(access_token: str, answers: list) -> bool: | ||
try: | ||
headers = web.get_auth_header(access_token) | ||
web.request('post', SECURITY_CHECK, exceptions=(PayloadError, Unauthorized, IPVerificationError), json=answers, headers=headers) | ||
except IPVerificationError: | ||
return False | ||
else: | ||
return True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.