Open yezz123 opened 1 year ago
As we have this point before https://github.com/pydantic/pydantic/issues/5012
password type, can mostly used strip_whitespace and min_length, but also integrate with https://github.com/dwolfhub/zxcvbn-python ???
from pydantic import BaseModel from pydantic_extra_types import PasswordStr class Data(BaseModel): password: PasswordStr def __init__(self, **data: Any): super().__init__(**data) def __repr__(self) -> str: return f'Data(password={self.password})' def test_password(): # Test password strength calculation d = Data(password='weakpassword') assert d.password.strength['score'] < 3 d = Data(password='strongpassword123') assert d.password.strength['score'] >= 1
@samuelcolvin This one also works fine locally you can test it before we merge it
As we have this point before https://github.com/pydantic/pydantic/issues/5012