Skip to content

PasswordValidator Protocol methods do not match #848

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
tilsche opened this issue Feb 10, 2022 · 0 comments · Fixed by #909
Closed

PasswordValidator Protocol methods do not match #848

tilsche opened this issue Feb 10, 2022 · 0 comments · Fixed by #909
Labels
bug Something isn't working

Comments

@tilsche
Copy link

tilsche commented Feb 10, 2022

Bug report

What's wrong

class PasswordValidator(Protocol):
    def password_changed(self, password: str, user: Optional[_UserModel] = ...): ...

How is that should be

The methods of all actual Validators look like this.

    def validate(self, password: str, user: Optional[_UserModel] = ...) -> None: ...
    def get_help_text(self) -> str: ...

I am not sure why this does not turn up as error for the given functions where it is used as parameters. E.g. contrib.auth.password_validation.validate_password uses the validate method of the argument / return value from get_default_password_validators typed PasswordValidator.

System information

  • django-stubs version: master
@tilsche tilsche added the bug Something isn't working label Feb 10, 2022
@sterliakov sterliakov mentioned this issue Apr 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

Successfully merging a pull request may close this issue.

1 participant