mirror of
https://github.com/langgenius/dify.git
synced 2026-06-24 13:01:16 +08:00
fix: correct misleading password length validation message (#37796)
This commit is contained in:
parent
04d226384f
commit
b98ba99b23
@ -13,7 +13,7 @@ def valid_password(password):
|
||||
if re.match(pattern, password) is not None:
|
||||
return password
|
||||
|
||||
raise ValueError("Password must contain letters and numbers, and the length must be greater than 8.")
|
||||
raise ValueError("Password must contain letters and numbers, and the length must be at least 8 characters.")
|
||||
|
||||
|
||||
def hash_password(password_str, salt_byte):
|
||||
|
||||
@ -35,6 +35,13 @@ class TestValidPassword:
|
||||
with pytest.raises(ValueError):
|
||||
valid_password("")
|
||||
|
||||
def test_should_reject_password_shorter_than_minimum_length(self):
|
||||
"""A 7-character password with letters and numbers is rejected for length."""
|
||||
with pytest.raises(ValueError) as exc_info:
|
||||
valid_password("abc1234")
|
||||
|
||||
assert "at least 8" in str(exc_info.value)
|
||||
|
||||
|
||||
class TestPasswordHashing:
|
||||
"""Test password hashing and comparison"""
|
||||
|
||||
Loading…
Reference in New Issue
Block a user