square-administration 1.2.1__py3-none-any.whl → 2.0.0__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_administration/routes/authentication.py +21 -2
- {square_administration-1.2.1.dist-info → square_administration-2.0.0.dist-info}/METADATA +5 -1
- {square_administration-1.2.1.dist-info → square_administration-2.0.0.dist-info}/RECORD +5 -5
- {square_administration-1.2.1.dist-info → square_administration-2.0.0.dist-info}/WHEEL +0 -0
- {square_administration-1.2.1.dist-info → square_administration-2.0.0.dist-info}/top_level.txt +0 -0
@@ -6,6 +6,7 @@ from fastapi import APIRouter, status, HTTPException, Header
|
|
6
6
|
from fastapi.responses import JSONResponse
|
7
7
|
from requests import HTTPError
|
8
8
|
from square_commons import get_api_output_in_standard_format
|
9
|
+
from square_commons.api_utils import create_cookie
|
9
10
|
|
10
11
|
from square_administration.configuration import (
|
11
12
|
global_object_square_logger,
|
@@ -66,14 +67,23 @@ async def register_username_v0(
|
|
66
67
|
"""
|
67
68
|
return value
|
68
69
|
"""
|
70
|
+
refresh_token = response["data"]["main"]["refresh_token"]
|
71
|
+
del response["data"]["main"]["refresh_token"]
|
69
72
|
output_content = get_api_output_in_standard_format(
|
70
73
|
message=messages["REGISTRATION_SUCCESSFUL"],
|
71
74
|
data={"main": response["data"]["main"]},
|
72
75
|
)
|
73
|
-
|
76
|
+
json_response = JSONResponse(
|
74
77
|
status_code=status.HTTP_201_CREATED,
|
75
78
|
content=output_content,
|
76
79
|
)
|
80
|
+
json_response.set_cookie(
|
81
|
+
**create_cookie(
|
82
|
+
key="refresh_token|" + str(global_int_app_id),
|
83
|
+
value=refresh_token,
|
84
|
+
)
|
85
|
+
)
|
86
|
+
return json_response
|
77
87
|
except HTTPError as http_error:
|
78
88
|
global_object_square_logger.logger.error(http_error, exc_info=True)
|
79
89
|
"""
|
@@ -133,14 +143,23 @@ async def login_username_v0(
|
|
133
143
|
"""
|
134
144
|
return value
|
135
145
|
"""
|
146
|
+
refresh_token = response["data"]["main"]["refresh_token"]
|
147
|
+
del response["data"]["main"]["refresh_token"]
|
136
148
|
output_content = get_api_output_in_standard_format(
|
137
149
|
message=messages["LOGIN_SUCCESSFUL"],
|
138
150
|
data={"main": response["data"]["main"]},
|
139
151
|
)
|
140
|
-
|
152
|
+
json_response = JSONResponse(
|
141
153
|
status_code=status.HTTP_200_OK,
|
142
154
|
content=output_content,
|
143
155
|
)
|
156
|
+
json_response.set_cookie(
|
157
|
+
**create_cookie(
|
158
|
+
key="refresh_token|" + str(global_int_app_id),
|
159
|
+
value=refresh_token,
|
160
|
+
)
|
161
|
+
)
|
162
|
+
return json_response
|
144
163
|
except HTTPError as http_error:
|
145
164
|
global_object_square_logger.logger.error(http_error, exc_info=True)
|
146
165
|
"""
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: square-administration
|
3
|
-
Version:
|
3
|
+
Version: 2.0.0
|
4
4
|
Summary: common business layer for my personal server.
|
5
5
|
Home-page: https://github.com/thepmsquare/square_administration
|
6
6
|
Author: thePmSquare
|
@@ -42,6 +42,10 @@ pip install square_administration
|
|
42
42
|
|
43
43
|
## changelog
|
44
44
|
|
45
|
+
### v2.0.0
|
46
|
+
|
47
|
+
- remove refresh token from response body and send in cookies.
|
48
|
+
|
45
49
|
### v1.2.1
|
46
50
|
|
47
51
|
- fix bug in core -> get_all_greetings_v0, now sending full response instead of only main.
|
@@ -7,10 +7,10 @@ square_administration/pydantic_models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCe
|
|
7
7
|
square_administration/pydantic_models/authentication.py,sha256=DWXctw5UWzkSVY7nMIQZsRhmgW3OK455OVcoUpJrPY0,202
|
8
8
|
square_administration/pydantic_models/core.py,sha256=HUMrBmfKrXeL-126gE5j2povdVmktn8XLg2tHEdeXTk,344
|
9
9
|
square_administration/routes/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
10
|
-
square_administration/routes/authentication.py,sha256=
|
10
|
+
square_administration/routes/authentication.py,sha256=Jifdsyd0NzrbR7X0OFJGwMl9JFhU4jXjhBIkIqwLkGU,7787
|
11
11
|
square_administration/routes/core.py,sha256=65_FIZilintZvbHx7r25UQbgN-oKdQ92-Nv3kpwKX6s,5374
|
12
12
|
square_administration/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
13
|
-
square_administration-
|
14
|
-
square_administration-
|
15
|
-
square_administration-
|
16
|
-
square_administration-
|
13
|
+
square_administration-2.0.0.dist-info/METADATA,sha256=iONUBJCUqHZq9s9-xT7HEqqvytZusnw3EfXFfEItvP8,1477
|
14
|
+
square_administration-2.0.0.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
|
15
|
+
square_administration-2.0.0.dist-info/top_level.txt,sha256=8WFipDrMQUPRDo5AvipxU1YK3wZtWZyCUMWaR416zAw,22
|
16
|
+
square_administration-2.0.0.dist-info/RECORD,,
|
File without changes
|
{square_administration-1.2.1.dist-info → square_administration-2.0.0.dist-info}/top_level.txt
RENAMED
File without changes
|