mirror of https://github.com/zulip/zulip.git
send_password_reset_email: Add a flag to only email users who need it.
Emailing the password reset email to users who have already logged in is not as useful.
This commit is contained in:
parent
6635f3ea12
commit
5b1387c9ba
|
@ -62,6 +62,13 @@ If you imported your organization into Zulip Cloud, simply e-mail
|
|||
./manage.py send_password_reset_email -r <subdomain> --all-users
|
||||
```
|
||||
|
||||
If you would like to only send emails to users who have not logged in yet,
|
||||
you can use the following variant instead:
|
||||
|
||||
```
|
||||
./manage.py send_password_reset_email -r <subdomain> --all-users --only-never-logged-in
|
||||
```
|
||||
|
||||
{end_tabs}
|
||||
|
||||
### Manual password resets
|
||||
|
|
|
@ -17,6 +17,11 @@ class Command(ZulipBaseCommand):
|
|||
|
||||
@override
|
||||
def add_arguments(self, parser: ArgumentParser) -> None:
|
||||
parser.add_argument(
|
||||
"--only-never-logged-in",
|
||||
action="store_true",
|
||||
help="Filter to only users which have not accepted the TOS.",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--entire-server", action="store_true", help="Send to every user on the server. "
|
||||
)
|
||||
|
@ -43,6 +48,11 @@ class Command(ZulipBaseCommand):
|
|||
"You have to pass -u/--users or -a/--all-users or --entire-server."
|
||||
)
|
||||
raise error
|
||||
if options["only_never_logged_in"]:
|
||||
users = users.filter(tos_version=-1)
|
||||
|
||||
if not users.exists():
|
||||
print("No matching users!")
|
||||
|
||||
self.send(users)
|
||||
|
||||
|
|
Loading…
Reference in New Issue