mirror of
https://github.com/zulip/zulip.git
synced 2025-11-03 13:33:24 +00:00
This is a preparatory commit for using isort for sorting all of our imports, merging changes to files where we can easily review the changes as something we're happy with. These are also files with relatively little active development, which means we don't expect much merge conflict risk from these changes.
26 lines
922 B
Python
26 lines
922 B
Python
from argparse import ArgumentParser
|
|
from typing import Any
|
|
|
|
from zerver.lib.actions import do_change_user_delivery_email
|
|
from zerver.lib.management import ZulipBaseCommand
|
|
|
|
|
|
class Command(ZulipBaseCommand):
|
|
help = """Change the email address for a user."""
|
|
|
|
def add_arguments(self, parser: ArgumentParser) -> None:
|
|
self.add_realm_args(parser)
|
|
parser.add_argument('old_email', metavar='<old email>', type=str,
|
|
help='email address to change')
|
|
parser.add_argument('new_email', metavar='<new email>', type=str,
|
|
help='new email address')
|
|
|
|
def handle(self, *args: Any, **options: str) -> None:
|
|
old_email = options['old_email']
|
|
new_email = options['new_email']
|
|
|
|
realm = self.get_realm(options)
|
|
user_profile = self.get_user(old_email, realm)
|
|
|
|
do_change_user_delivery_email(user_profile, new_email)
|