square-authentication 6.2.0__tar.gz → 6.2.1__tar.gz
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-6.2.0 → square_authentication-6.2.1}/PKG-INFO +6 -1
- {square_authentication-6.2.0 → square_authentication-6.2.1}/README.md +5 -0
- {square_authentication-6.2.0 → square_authentication-6.2.1}/setup.py +1 -1
- {square_authentication-6.2.0 → square_authentication-6.2.1}/square_authentication/routes/core.py +2 -10
- {square_authentication-6.2.0 → square_authentication-6.2.1}/square_authentication.egg-info/PKG-INFO +6 -1
- {square_authentication-6.2.0 → square_authentication-6.2.1}/tests/test_username.py +7 -7
- {square_authentication-6.2.0 → square_authentication-6.2.1}/setup.cfg +0 -0
- {square_authentication-6.2.0 → square_authentication-6.2.1}/square_authentication/__init__.py +0 -0
- {square_authentication-6.2.0 → square_authentication-6.2.1}/square_authentication/configuration.py +0 -0
- {square_authentication-6.2.0 → square_authentication-6.2.1}/square_authentication/data/config.ini +0 -0
- {square_authentication-6.2.0 → square_authentication-6.2.1}/square_authentication/data/config.testing.ini +0 -0
- {square_authentication-6.2.0 → square_authentication-6.2.1}/square_authentication/main.py +0 -0
- {square_authentication-6.2.0 → square_authentication-6.2.1}/square_authentication/messages.py +0 -0
- {square_authentication-6.2.0 → square_authentication-6.2.1}/square_authentication/pydantic_models/__init__.py +0 -0
- {square_authentication-6.2.0 → square_authentication-6.2.1}/square_authentication/pydantic_models/core.py +0 -0
- {square_authentication-6.2.0 → square_authentication-6.2.1}/square_authentication/routes/__init__.py +0 -0
- {square_authentication-6.2.0 → square_authentication-6.2.1}/square_authentication/routes/profile.py +0 -0
- {square_authentication-6.2.0 → square_authentication-6.2.1}/square_authentication/routes/utility.py +0 -0
- {square_authentication-6.2.0 → square_authentication-6.2.1}/square_authentication/utils/__init__.py +0 -0
- {square_authentication-6.2.0 → square_authentication-6.2.1}/square_authentication/utils/encryption.py +0 -0
- {square_authentication-6.2.0 → square_authentication-6.2.1}/square_authentication/utils/token.py +0 -0
- {square_authentication-6.2.0 → square_authentication-6.2.1}/square_authentication.egg-info/SOURCES.txt +0 -0
- {square_authentication-6.2.0 → square_authentication-6.2.1}/square_authentication.egg-info/dependency_links.txt +0 -0
- {square_authentication-6.2.0 → square_authentication-6.2.1}/square_authentication.egg-info/requires.txt +0 -0
- {square_authentication-6.2.0 → square_authentication-6.2.1}/square_authentication.egg-info/top_level.txt +0 -0
- {square_authentication-6.2.0 → square_authentication-6.2.1}/tests/test_1.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: square_authentication
|
3
|
-
Version: 6.2.
|
3
|
+
Version: 6.2.1
|
4
4
|
Summary: authentication layer for my personal server.
|
5
5
|
Home-page: https://github.com/thepmsquare/square_authentication
|
6
6
|
Author: thePmSquare
|
@@ -53,6 +53,11 @@ pip install square_authentication
|
|
53
53
|
|
54
54
|
## changelog
|
55
55
|
|
56
|
+
### v6.2.1
|
57
|
+
|
58
|
+
- core
|
59
|
+
- tweak validation for username in register_username_v0 and update_username_v0.
|
60
|
+
|
56
61
|
### v6.2.0
|
57
62
|
|
58
63
|
- core
|
{square_authentication-6.2.0 → square_authentication-6.2.1}/square_authentication/routes/core.py
RENAMED
@@ -70,11 +70,7 @@ async def register_username_v0(
|
|
70
70
|
validation
|
71
71
|
"""
|
72
72
|
# validation for username
|
73
|
-
|
74
|
-
# [a-z] # must start with a lowercase letter
|
75
|
-
# (?:[a-z0-9_-]{1,18}) # 1–18 of lowercase, digits, _ or -
|
76
|
-
# [a-z]$ # must end with a lowercase letter
|
77
|
-
username_pattern = re.compile(r"^(?!.*[._-]{2})[a-z][a-z0-9_-]{1,18}[a-z]$")
|
73
|
+
username_pattern = re.compile(r"^[a-z0-9._-]{2,20}$")
|
78
74
|
if not username_pattern.match(username):
|
79
75
|
output_content = get_api_output_in_standard_format(
|
80
76
|
message=messages["USERNAME_INVALID"],
|
@@ -1118,12 +1114,8 @@ async def update_username_v0(
|
|
1118
1114
|
user_id = local_dict_access_token_payload["user_id"]
|
1119
1115
|
|
1120
1116
|
# validation for username
|
1121
|
-
# ^(?!.*[_-]{2}) # no consecutive _ or -
|
1122
|
-
# [a-z] # must start with a lowercase letter
|
1123
|
-
# (?:[a-z0-9_-]{1,18}) # 1–18 of lowercase, digits, _ or -
|
1124
|
-
# [a-z]$ # must end with a lowercase letter
|
1125
1117
|
new_username = new_username.lower()
|
1126
|
-
username_pattern = re.compile(r"^
|
1118
|
+
username_pattern = re.compile(r"^[a-z0-9._-]{2,20}$")
|
1127
1119
|
if not username_pattern.match(new_username):
|
1128
1120
|
output_content = get_api_output_in_standard_format(
|
1129
1121
|
message=messages["USERNAME_INVALID"],
|
{square_authentication-6.2.0 → square_authentication-6.2.1}/square_authentication.egg-info/PKG-INFO
RENAMED
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: square_authentication
|
3
|
-
Version: 6.2.
|
3
|
+
Version: 6.2.1
|
4
4
|
Summary: authentication layer for my personal server.
|
5
5
|
Home-page: https://github.com/thepmsquare/square_authentication
|
6
6
|
Author: thePmSquare
|
@@ -53,6 +53,11 @@ pip install square_authentication
|
|
53
53
|
|
54
54
|
## changelog
|
55
55
|
|
56
|
+
### v6.2.1
|
57
|
+
|
58
|
+
- core
|
59
|
+
- tweak validation for username in register_username_v0 and update_username_v0.
|
60
|
+
|
56
61
|
### v6.2.0
|
57
62
|
|
58
63
|
- core
|
@@ -1,15 +1,15 @@
|
|
1
1
|
from square_authentication.messages import messages
|
2
2
|
|
3
3
|
|
4
|
-
def
|
4
|
+
def test_register_username_consecutive_special_chars(create_client_and_cleanup):
|
5
5
|
payload = {
|
6
6
|
"username": "invalid..name",
|
7
7
|
"password": "testpass123",
|
8
8
|
"app_id": 1,
|
9
9
|
}
|
10
10
|
response = create_client_and_cleanup.post("/register_username/v0", json=payload)
|
11
|
-
assert response.status_code ==
|
12
|
-
assert
|
11
|
+
assert response.status_code == 201
|
12
|
+
assert response.json()["message"] == messages["REGISTRATION_SUCCESSFUL"]
|
13
13
|
|
14
14
|
|
15
15
|
def test_username_starts_with_number(create_client_and_cleanup):
|
@@ -19,8 +19,8 @@ def test_username_starts_with_number(create_client_and_cleanup):
|
|
19
19
|
"app_id": 1,
|
20
20
|
}
|
21
21
|
response = create_client_and_cleanup.post("/register_username/v0", json=payload)
|
22
|
-
assert response.status_code ==
|
23
|
-
assert
|
22
|
+
assert response.status_code == 201
|
23
|
+
assert response.json()["message"] == messages["REGISTRATION_SUCCESSFUL"]
|
24
24
|
|
25
25
|
|
26
26
|
def test_username_ends_with_number(create_client_and_cleanup):
|
@@ -30,8 +30,8 @@ def test_username_ends_with_number(create_client_and_cleanup):
|
|
30
30
|
"app_id": 1,
|
31
31
|
}
|
32
32
|
response = create_client_and_cleanup.post("/register_username/v0", json=payload)
|
33
|
-
assert response.status_code ==
|
34
|
-
assert
|
33
|
+
assert response.status_code == 201
|
34
|
+
assert response.json()["message"] == messages["REGISTRATION_SUCCESSFUL"]
|
35
35
|
|
36
36
|
|
37
37
|
def test_username_with_space(create_client_and_cleanup):
|
File without changes
|
{square_authentication-6.2.0 → square_authentication-6.2.1}/square_authentication/__init__.py
RENAMED
File without changes
|
{square_authentication-6.2.0 → square_authentication-6.2.1}/square_authentication/configuration.py
RENAMED
File without changes
|
{square_authentication-6.2.0 → square_authentication-6.2.1}/square_authentication/data/config.ini
RENAMED
File without changes
|
File without changes
|
File without changes
|
{square_authentication-6.2.0 → square_authentication-6.2.1}/square_authentication/messages.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
{square_authentication-6.2.0 → square_authentication-6.2.1}/square_authentication/routes/__init__.py
RENAMED
File without changes
|
{square_authentication-6.2.0 → square_authentication-6.2.1}/square_authentication/routes/profile.py
RENAMED
File without changes
|
{square_authentication-6.2.0 → square_authentication-6.2.1}/square_authentication/routes/utility.py
RENAMED
File without changes
|
{square_authentication-6.2.0 → square_authentication-6.2.1}/square_authentication/utils/__init__.py
RENAMED
File without changes
|
File without changes
|
{square_authentication-6.2.0 → square_authentication-6.2.1}/square_authentication/utils/token.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|