mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-12-23 08:36:32 +00:00
Merge pull request #2381 from jaschaurbach/deactivate-2fa-with-manage.py
Remove TFA from user
This commit is contained in:
commit
c64914b41b
2 changed files with 28 additions and 0 deletions
22
bookwyrm/management/commands/remove_2fa.py
Normal file
22
bookwyrm/management/commands/remove_2fa.py
Normal file
|
@ -0,0 +1,22 @@
|
|||
"""deactivate two factor auth"""
|
||||
|
||||
from django.core.management.base import BaseCommand, CommandError
|
||||
from bookwyrm import models
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
"""command-line options"""
|
||||
|
||||
help = "Remove Two Factor Authorisation from 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.two_factor_auth = False
|
||||
user.save(broadcast=False, update_fields=["two_factor_auth"])
|
||||
self.stdout.write(
|
||||
self.style.SUCCESS("Two Factor Authorisation was removed from user")
|
||||
)
|
6
bw-dev
6
bw-dev
|
@ -63,6 +63,8 @@ function awscommand {
|
|||
amazon/aws-cli $2
|
||||
}
|
||||
|
||||
|
||||
|
||||
CMD=$1
|
||||
if [ -n "$CMD" ]; then
|
||||
shift
|
||||
|
@ -255,6 +257,9 @@ case "$CMD" in
|
|||
runweb)
|
||||
runweb "$@"
|
||||
;;
|
||||
remove_2fa)
|
||||
runweb python manage.py remove_2fa "$@"
|
||||
;;
|
||||
*)
|
||||
set +x # No need to echo echo
|
||||
echo "Unrecognised command. Try:"
|
||||
|
@ -290,5 +295,6 @@ case "$CMD" in
|
|||
echo " sync_media_to_s3"
|
||||
echo " set_cors_to_s3 [cors file]"
|
||||
echo " runweb [command]"
|
||||
echo " remove_2fa"
|
||||
;;
|
||||
esac
|
||||
|
|
Loading…
Reference in a new issue