mirror of
https://github.com/zulip/zulip.git
synced 2025-10-22 20:42:14 +00:00
forms: Use monkey-patched SetPasswordForm generic.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
committed by
Tim Abbott
parent
3be686fa86
commit
b1a7db3662
@@ -25,7 +25,9 @@ class ZerverConfig(AppConfig):
|
||||
|
||||
setup_sentry(settings.SENTRY_DSN, get_config("machine", "deploy_type", "development"))
|
||||
|
||||
django_stubs_ext.monkeypatch()
|
||||
from django.contrib.auth.forms import SetPasswordMixin
|
||||
|
||||
django_stubs_ext.monkeypatch(extra_classes=[SetPasswordMixin])
|
||||
|
||||
# We import zerver.signals here for the side effect of
|
||||
# registering the user_logged_in signal receiver. This import
|
||||
|
@@ -2,7 +2,7 @@ import base64
|
||||
import logging
|
||||
import re
|
||||
from email.headerregistry import Address
|
||||
from typing import TYPE_CHECKING, Any, TypeAlias
|
||||
from typing import Any
|
||||
|
||||
import dns.resolver
|
||||
import orjson
|
||||
@@ -430,14 +430,7 @@ class CaptchaRealmCreationForm(RealmCreationForm):
|
||||
return payload
|
||||
|
||||
|
||||
# https://github.com/typeddjango/django-stubs/pull/2384#pullrequestreview-2813849209
|
||||
if TYPE_CHECKING:
|
||||
BaseSetPasswordForm: TypeAlias = SetPasswordForm[UserProfile]
|
||||
else:
|
||||
BaseSetPasswordForm = SetPasswordForm
|
||||
|
||||
|
||||
class LoggingSetPasswordForm(BaseSetPasswordForm):
|
||||
class LoggingSetPasswordForm(SetPasswordForm[UserProfile]):
|
||||
new_password1 = forms.CharField(
|
||||
label=_("New password"),
|
||||
widget=forms.PasswordInput(attrs={"autocomplete": "new-password"}),
|
||||
|
Reference in New Issue
Block a user