square-authentication 10.0.0__py3-none-any.whl → 10.0.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- square_authentication/routes/core.py +166 -3002
- square_authentication/routes/profile.py +38 -579
- square_authentication/routes/utility.py +7 -37
- square_authentication/utils/routes/__init__.py +0 -0
- square_authentication/utils/routes/core.py +3251 -0
- square_authentication/utils/routes/profile.py +647 -0
- square_authentication/utils/routes/utility.py +55 -0
- {square_authentication-10.0.0.dist-info → square_authentication-10.0.2.dist-info}/METADATA +7 -2
- {square_authentication-10.0.0.dist-info → square_authentication-10.0.2.dist-info}/RECORD +12 -8
- {square_authentication-10.0.0.dist-info → square_authentication-10.0.2.dist-info}/WHEEL +0 -0
- {square_authentication-10.0.0.dist-info → square_authentication-10.0.2.dist-info}/licenses/LICENSE +0 -0
- {square_authentication-10.0.0.dist-info → square_authentication-10.0.2.dist-info}/top_level.txt +0 -0
@@ -1,10 +1,10 @@
|
|
1
|
-
import bcrypt
|
2
1
|
from fastapi import APIRouter, status, HTTPException
|
3
2
|
from fastapi.responses import JSONResponse
|
4
3
|
from square_commons import get_api_output_in_standard_format
|
5
4
|
|
6
5
|
from square_authentication.configuration import global_object_square_logger
|
7
6
|
from square_authentication.messages import messages
|
7
|
+
from square_authentication.utils.routes.utility import util_get_text_hash_v0
|
8
8
|
|
9
9
|
router = APIRouter(
|
10
10
|
tags=["utility"],
|
@@ -14,47 +14,17 @@ router = APIRouter(
|
|
14
14
|
@router.get("/get_text_hash/v0")
|
15
15
|
@global_object_square_logger.auto_logger()
|
16
16
|
async def get_text_hash_v0(plain_text: str):
|
17
|
-
|
18
17
|
try:
|
19
|
-
|
20
|
-
|
21
|
-
"""
|
22
|
-
# pass
|
23
|
-
"""
|
24
|
-
main process
|
25
|
-
"""
|
26
|
-
local_str_hashed_text = bcrypt.hashpw(
|
27
|
-
plain_text.encode("utf-8"), bcrypt.gensalt()
|
28
|
-
).decode("utf-8")
|
29
|
-
"""
|
30
|
-
return value
|
31
|
-
"""
|
32
|
-
output_content = get_api_output_in_standard_format(
|
33
|
-
message=messages["GENERIC_READ_SUCCESSFUL"],
|
34
|
-
data={"main": local_str_hashed_text},
|
35
|
-
)
|
36
|
-
return JSONResponse(
|
37
|
-
status_code=status.HTTP_200_OK,
|
38
|
-
content=output_content,
|
39
|
-
)
|
40
|
-
except HTTPException as http_exception:
|
41
|
-
global_object_square_logger.logger.error(http_exception, exc_info=True)
|
42
|
-
"""
|
43
|
-
rollback logic
|
44
|
-
"""
|
45
|
-
# pass
|
46
|
-
return JSONResponse(
|
47
|
-
status_code=http_exception.status_code, content=http_exception.detail
|
18
|
+
return util_get_text_hash_v0(
|
19
|
+
plain_text=plain_text,
|
48
20
|
)
|
21
|
+
except HTTPException as he:
|
22
|
+
global_object_square_logger.logger.error(he, exc_info=True)
|
23
|
+
return JSONResponse(status_code=he.status_code, content=he.detail)
|
49
24
|
except Exception as e:
|
50
25
|
global_object_square_logger.logger.error(e, exc_info=True)
|
51
|
-
"""
|
52
|
-
rollback logic
|
53
|
-
"""
|
54
|
-
# pass
|
55
26
|
output_content = get_api_output_in_standard_format(
|
56
|
-
message=messages["GENERIC_500"],
|
57
|
-
log=str(e),
|
27
|
+
message=messages["GENERIC_500"], log=str(e)
|
58
28
|
)
|
59
29
|
return JSONResponse(
|
60
30
|
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, content=output_content
|
File without changes
|