mirror of
https://github.com/zulip/zulip.git
synced 2025-10-23 04:52:12 +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"))
|
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
|
# We import zerver.signals here for the side effect of
|
||||||
# registering the user_logged_in signal receiver. This import
|
# registering the user_logged_in signal receiver. This import
|
||||||
|
@@ -2,7 +2,7 @@ import base64
|
|||||||
import logging
|
import logging
|
||||||
import re
|
import re
|
||||||
from email.headerregistry import Address
|
from email.headerregistry import Address
|
||||||
from typing import TYPE_CHECKING, Any, TypeAlias
|
from typing import Any
|
||||||
|
|
||||||
import dns.resolver
|
import dns.resolver
|
||||||
import orjson
|
import orjson
|
||||||
@@ -430,14 +430,7 @@ class CaptchaRealmCreationForm(RealmCreationForm):
|
|||||||
return payload
|
return payload
|
||||||
|
|
||||||
|
|
||||||
# https://github.com/typeddjango/django-stubs/pull/2384#pullrequestreview-2813849209
|
class LoggingSetPasswordForm(SetPasswordForm[UserProfile]):
|
||||||
if TYPE_CHECKING:
|
|
||||||
BaseSetPasswordForm: TypeAlias = SetPasswordForm[UserProfile]
|
|
||||||
else:
|
|
||||||
BaseSetPasswordForm = SetPasswordForm
|
|
||||||
|
|
||||||
|
|
||||||
class LoggingSetPasswordForm(BaseSetPasswordForm):
|
|
||||||
new_password1 = forms.CharField(
|
new_password1 = forms.CharField(
|
||||||
label=_("New password"),
|
label=_("New password"),
|
||||||
widget=forms.PasswordInput(attrs={"autocomplete": "new-password"}),
|
widget=forms.PasswordInput(attrs={"autocomplete": "new-password"}),
|
||||||
|
Reference in New Issue
Block a user