12 lines
341 B
Python
12 lines
341 B
Python
from typing import Any
|
|
|
|
|
|
def ensure_password(value: Any) -> Any:
|
|
if not isinstance(value, str):
|
|
raise TypeError("Password must be a string")
|
|
if len(value) < 8:
|
|
raise ValueError("Password must be at least 8 characters")
|
|
if value.strip() == "":
|
|
raise ValueError("Password cannot be empty")
|
|
return value
|