mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2025-02-16 19:15:16 +00:00
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.
This commit is contained in:
parent
a9846e7805
commit
ea316627be
5 changed files with 31 additions and 0 deletions
19
bookwyrm/management/commands/confirm_email.py
Normal file
19
bookwyrm/management/commands/confirm_email.py
Normal file
|
@ -0,0 +1,19 @@
|
|||
""" 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."))
|
4
bw-dev
4
bw-dev
|
@ -265,6 +265,9 @@ case "$CMD" in
|
|||
remove_2fa)
|
||||
runweb python manage.py remove_2fa "$@"
|
||||
;;
|
||||
confirm_email)
|
||||
runweb python manage.py confirm_email "$@"
|
||||
;;
|
||||
*)
|
||||
set +x # No need to echo echo
|
||||
echo "Unrecognised command. Try:"
|
||||
|
@ -302,5 +305,6 @@ case "$CMD" in
|
|||
echo " set_cors_to_s3 [cors file]"
|
||||
echo " runweb [command]"
|
||||
echo " remove_2fa"
|
||||
echo " confirm_email"
|
||||
;;
|
||||
esac
|
||||
|
|
|
@ -35,6 +35,8 @@ copy_media_to_s3 \
|
|||
set_cors_to_s3 \
|
||||
setup \
|
||||
admin_code \
|
||||
remove_2fa \
|
||||
confirm_email \
|
||||
runweb
|
||||
|
||||
function __bw_complete -a cmds cmd desc
|
||||
|
@ -74,6 +76,8 @@ __bw_complete "$commands" "sync_media_to_s3" "run the `s3 sync` command t
|
|||
__bw_complete "$commands" "set_cors_to_s3" "push a CORS configuration defined in .json to s3"
|
||||
__bw_complete "$commands" "setup" "perform first-time setup"
|
||||
__bw_complete "$commands" "admin_code" "get the admin code"
|
||||
__bw_complete "$commands" "remove_2fa" "remove 2FA from user"
|
||||
__bw_complete "$commands" "confirm_email" "manually confirm email of user and set active"
|
||||
__bw_complete "$commands" "runweb" "run a command on the web container"
|
||||
|
||||
|
||||
|
|
|
@ -32,4 +32,6 @@ copy_media_to_s3
|
|||
set_cors_to_s3
|
||||
setup
|
||||
admin_code
|
||||
remove_2fa
|
||||
confirm_email
|
||||
runweb" -o bashdefault -o default bw-dev
|
||||
|
|
|
@ -34,4 +34,6 @@ copy_media_to_s3
|
|||
set_cors_to_s3
|
||||
setup
|
||||
admin_code
|
||||
remove_2fa
|
||||
confirm_email
|
||||
runweb" -o bashdefault -o default bw-dev
|
||||
|
|
Loading…
Reference in a new issue