bookwyrm/bookwyrm/management/commands/confirm_email.py
Jascha Urbach ea316627be
Manual email confirm (#2492)
* manual approve email via bw-dev/manage.py

./bw-dev confirm_email USER
(venv) python manage.py confirm_email USER

* add "confirm_email" and "remove_2fa" to autocompletion

* OK, sometimes I feel fooled by this.

The lione was not LONG ENOUGH.

* Change deactivate reason to None

* Whyever this works now

Python in my system is a wondermachine.
2022-12-11 12:35:20 -08:00

20 lines
543 B
Python

""" manually confirm e-mail of user """
from django.core.management.base import BaseCommand
from bookwyrm import models
class Command(BaseCommand):
"""command-line options"""
help = "Manually confirm email for user"
def add_arguments(self, parser):
parser.add_argument("username")
def handle(self, *args, **options):
name = options["username"]
user = models.User.objects.get(localname=name)
user.reactivate()
self.stdout.write(self.style.SUCCESS("User's email is now confirmed."))