mirror of
https://github.com/zulip/zulip.git
synced 2025-11-06 23:13:25 +00:00
management: Fix password reset emails being sent to deactivated users.
Apparently, the filters written for the send_password_reset_email (and some other management commands) didn't correctly consider the case of deactivated users. While some commands, like syncing LDAP data (which can include whether a user should be deactivated) want to process all users, other commands generally only want to interact with active users. We fix this and add some tests.
This commit is contained in:
@@ -41,7 +41,8 @@ class Command(ZulipBaseCommand):
|
||||
def handle(self, *args: Any, **options: Any) -> None:
|
||||
if options.get('realm_id') is not None:
|
||||
realm = self.get_realm(options)
|
||||
user_profiles = self.get_users(options, realm, is_bot=False)
|
||||
user_profiles = self.get_users(options, realm, is_bot=False,
|
||||
include_deactivated=True)
|
||||
else:
|
||||
user_profiles = UserProfile.objects.select_related().filter(is_bot=False)
|
||||
sync_ldap_user_data(user_profiles)
|
||||
|
||||
Reference in New Issue
Block a user