mirror of https://github.com/zulip/zulip.git
send_password_reset_email: Narrow type of users.
5a32ea52ae
changed the return type of `get_users`, enabling this. (cherry picked from commitc4b4a8de5b
)
This commit is contained in:
parent
21cff09737
commit
1a230d9d45
|
@ -1,8 +1,9 @@
|
||||||
from argparse import ArgumentParser
|
from argparse import ArgumentParser
|
||||||
from typing import Any, Iterable
|
from typing import Any
|
||||||
|
|
||||||
from django.contrib.auth.tokens import default_token_generator
|
from django.contrib.auth.tokens import default_token_generator
|
||||||
from django.core.management.base import CommandError
|
from django.core.management.base import CommandError
|
||||||
|
from django.db.models import QuerySet
|
||||||
from typing_extensions import override
|
from typing_extensions import override
|
||||||
|
|
||||||
from zerver.forms import generate_password_reset_url
|
from zerver.forms import generate_password_reset_url
|
||||||
|
@ -29,7 +30,7 @@ class Command(ZulipBaseCommand):
|
||||||
@override
|
@override
|
||||||
def handle(self, *args: Any, **options: str) -> None:
|
def handle(self, *args: Any, **options: str) -> None:
|
||||||
if options["entire_server"]:
|
if options["entire_server"]:
|
||||||
users: Iterable[UserProfile] = UserProfile.objects.filter(
|
users: QuerySet[UserProfile] = UserProfile.objects.filter(
|
||||||
is_active=True, is_bot=False, is_mirror_dummy=False
|
is_active=True, is_bot=False, is_mirror_dummy=False
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
|
@ -45,7 +46,7 @@ class Command(ZulipBaseCommand):
|
||||||
|
|
||||||
self.send(users)
|
self.send(users)
|
||||||
|
|
||||||
def send(self, users: Iterable[UserProfile]) -> None:
|
def send(self, users: QuerySet[UserProfile]) -> None:
|
||||||
"""Sends one-use only links for resetting password to target users"""
|
"""Sends one-use only links for resetting password to target users"""
|
||||||
for user_profile in users:
|
for user_profile in users:
|
||||||
context = {
|
context = {
|
||||||
|
|
Loading…
Reference in New Issue