square-authentication 6.2.0__tar.gz → 6.2.2__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.
Files changed (26) hide show
  1. {square_authentication-6.2.0 → square_authentication-6.2.2}/PKG-INFO +11 -2
  2. {square_authentication-6.2.0 → square_authentication-6.2.2}/README.md +9 -0
  3. {square_authentication-6.2.0 → square_authentication-6.2.2}/setup.py +2 -2
  4. {square_authentication-6.2.0 → square_authentication-6.2.2}/square_authentication/configuration.py +6 -1
  5. {square_authentication-6.2.0 → square_authentication-6.2.2}/square_authentication/routes/core.py +2 -10
  6. {square_authentication-6.2.0 → square_authentication-6.2.2}/square_authentication.egg-info/PKG-INFO +11 -2
  7. {square_authentication-6.2.0 → square_authentication-6.2.2}/square_authentication.egg-info/SOURCES.txt +2 -2
  8. {square_authentication-6.2.0 → square_authentication-6.2.2}/square_authentication.egg-info/requires.txt +1 -1
  9. {square_authentication-6.2.0 → square_authentication-6.2.2}/tests/test_username.py +7 -7
  10. {square_authentication-6.2.0 → square_authentication-6.2.2}/setup.cfg +0 -0
  11. {square_authentication-6.2.0 → square_authentication-6.2.2}/square_authentication/__init__.py +0 -0
  12. /square_authentication-6.2.0/square_authentication/data/config.ini → /square_authentication-6.2.2/square_authentication/data/config.sample.ini +0 -0
  13. /square_authentication-6.2.0/square_authentication/data/config.testing.ini → /square_authentication-6.2.2/square_authentication/data/config.testing.sample.ini +0 -0
  14. {square_authentication-6.2.0 → square_authentication-6.2.2}/square_authentication/main.py +0 -0
  15. {square_authentication-6.2.0 → square_authentication-6.2.2}/square_authentication/messages.py +0 -0
  16. {square_authentication-6.2.0 → square_authentication-6.2.2}/square_authentication/pydantic_models/__init__.py +0 -0
  17. {square_authentication-6.2.0 → square_authentication-6.2.2}/square_authentication/pydantic_models/core.py +0 -0
  18. {square_authentication-6.2.0 → square_authentication-6.2.2}/square_authentication/routes/__init__.py +0 -0
  19. {square_authentication-6.2.0 → square_authentication-6.2.2}/square_authentication/routes/profile.py +0 -0
  20. {square_authentication-6.2.0 → square_authentication-6.2.2}/square_authentication/routes/utility.py +0 -0
  21. {square_authentication-6.2.0 → square_authentication-6.2.2}/square_authentication/utils/__init__.py +0 -0
  22. {square_authentication-6.2.0 → square_authentication-6.2.2}/square_authentication/utils/encryption.py +0 -0
  23. {square_authentication-6.2.0 → square_authentication-6.2.2}/square_authentication/utils/token.py +0 -0
  24. {square_authentication-6.2.0 → square_authentication-6.2.2}/square_authentication.egg-info/dependency_links.txt +0 -0
  25. {square_authentication-6.2.0 → square_authentication-6.2.2}/square_authentication.egg-info/top_level.txt +0 -0
  26. {square_authentication-6.2.0 → square_authentication-6.2.2}/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.0
3
+ Version: 6.2.2
4
4
  Summary: authentication layer for my personal server.
5
5
  Home-page: https://github.com/thepmsquare/square_authentication
6
6
  Author: thePmSquare
@@ -19,7 +19,7 @@ Requires-Dist: bcrypt>=4.1.2
19
19
  Requires-Dist: pyjwt>=2.8.0
20
20
  Requires-Dist: requests>=2.32.3
21
21
  Requires-Dist: cryptography>=42.0.7
22
- Requires-Dist: square_commons>=1.0.0
22
+ Requires-Dist: square_commons>=2.1.0
23
23
  Requires-Dist: square_logger>=2.0.0
24
24
  Requires-Dist: square_database_helper>=2.0.0
25
25
  Requires-Dist: square_database_structure>=2.3.1
@@ -53,6 +53,15 @@ pip install square_authentication
53
53
 
54
54
  ## changelog
55
55
 
56
+ ### v6.2.2
57
+
58
+ - remove config.ini and config.testing.ini from version control.
59
+
60
+ ### v6.2.1
61
+
62
+ - core
63
+ - tweak validation for username in register_username_v0 and update_username_v0.
64
+
56
65
  ### v6.2.0
57
66
 
58
67
  - core
@@ -16,6 +16,15 @@ pip install square_authentication
16
16
 
17
17
  ## changelog
18
18
 
19
+ ### v6.2.2
20
+
21
+ - remove config.ini and config.testing.ini from version control.
22
+
23
+ ### v6.2.1
24
+
25
+ - core
26
+ - tweak validation for username in register_username_v0 and update_username_v0.
27
+
19
28
  ### v6.2.0
20
29
 
21
30
  - core
@@ -4,7 +4,7 @@ package_name = "square_authentication"
4
4
 
5
5
  setup(
6
6
  name=package_name,
7
- version="6.2.0",
7
+ version="6.2.2",
8
8
  packages=find_packages(),
9
9
  package_data={
10
10
  package_name: ["data/*"],
@@ -18,7 +18,7 @@ setup(
18
18
  "pyjwt>=2.8.0",
19
19
  "requests>=2.32.3",
20
20
  "cryptography>=42.0.7",
21
- "square_commons>=1.0.0",
21
+ "square_commons>=2.1.0",
22
22
  "square_logger>=2.0.0",
23
23
  "square_database_helper>=2.0.0",
24
24
  "square_database_structure>=2.3.1",
@@ -10,7 +10,12 @@ try:
10
10
  config_file_path = os.path.join(
11
11
  os.path.dirname(os.path.abspath(__file__)), "data", "config.ini"
12
12
  )
13
- ldict_configuration = ConfigReader(config_file_path).read_configuration()
13
+ config_sample_file_path = os.path.join(
14
+ os.path.dirname(os.path.abspath(__file__)), "data", "config.sample.ini"
15
+ )
16
+ ldict_configuration = ConfigReader(
17
+ config_file_path, config_sample_file_path
18
+ ).read_configuration()
14
19
 
15
20
  # get all vars and typecast
16
21
  # ===========================================
@@ -70,11 +70,7 @@ async def register_username_v0(
70
70
  validation
71
71
  """
72
72
  # validation for username
73
- # ^(?!.*[_-]{2}) # no consecutive _ or -
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"^(?!.*[._-]{2})[a-z][a-z0-9_-]{1,18}[a-z]$")
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"],
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: square_authentication
3
- Version: 6.2.0
3
+ Version: 6.2.2
4
4
  Summary: authentication layer for my personal server.
5
5
  Home-page: https://github.com/thepmsquare/square_authentication
6
6
  Author: thePmSquare
@@ -19,7 +19,7 @@ Requires-Dist: bcrypt>=4.1.2
19
19
  Requires-Dist: pyjwt>=2.8.0
20
20
  Requires-Dist: requests>=2.32.3
21
21
  Requires-Dist: cryptography>=42.0.7
22
- Requires-Dist: square_commons>=1.0.0
22
+ Requires-Dist: square_commons>=2.1.0
23
23
  Requires-Dist: square_logger>=2.0.0
24
24
  Requires-Dist: square_database_helper>=2.0.0
25
25
  Requires-Dist: square_database_structure>=2.3.1
@@ -53,6 +53,15 @@ pip install square_authentication
53
53
 
54
54
  ## changelog
55
55
 
56
+ ### v6.2.2
57
+
58
+ - remove config.ini and config.testing.ini from version control.
59
+
60
+ ### v6.2.1
61
+
62
+ - core
63
+ - tweak validation for username in register_username_v0 and update_username_v0.
64
+
56
65
  ### v6.2.0
57
66
 
58
67
  - core
@@ -9,8 +9,8 @@ square_authentication.egg-info/SOURCES.txt
9
9
  square_authentication.egg-info/dependency_links.txt
10
10
  square_authentication.egg-info/requires.txt
11
11
  square_authentication.egg-info/top_level.txt
12
- square_authentication/data/config.ini
13
- square_authentication/data/config.testing.ini
12
+ square_authentication/data/config.sample.ini
13
+ square_authentication/data/config.testing.sample.ini
14
14
  square_authentication/pydantic_models/__init__.py
15
15
  square_authentication/pydantic_models/core.py
16
16
  square_authentication/routes/__init__.py
@@ -6,7 +6,7 @@ bcrypt>=4.1.2
6
6
  pyjwt>=2.8.0
7
7
  requests>=2.32.3
8
8
  cryptography>=42.0.7
9
- square_commons>=1.0.0
9
+ square_commons>=2.1.0
10
10
  square_logger>=2.0.0
11
11
  square_database_helper>=2.0.0
12
12
  square_database_structure>=2.3.1
@@ -1,15 +1,15 @@
1
1
  from square_authentication.messages import messages
2
2
 
3
3
 
4
- def test_register_username_invalid(create_client_and_cleanup):
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 == 400
12
- assert "username" in response.json()["log"]
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 == 400
23
- assert "username" in response.json()["log"]
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 == 400
34
- assert "username" in response.json()["log"]
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):