From 78a8e63e0a4690d9d9432e0a8676c11db572de4f Mon Sep 17 00:00:00 2001 From: wh1te909 Date: Sun, 2 Feb 2020 09:30:50 +0000 Subject: [PATCH] expire all auth tokens when updating (will force page reload to pull latest index.html) --- .../accounts/management/commands/delete_tokens.py | 10 ++++++++++ update.sh | 1 + 2 files changed, 11 insertions(+) create mode 100644 api/tacticalrmm/accounts/management/commands/delete_tokens.py diff --git a/api/tacticalrmm/accounts/management/commands/delete_tokens.py b/api/tacticalrmm/accounts/management/commands/delete_tokens.py new file mode 100644 index 00000000..5765b2b4 --- /dev/null +++ b/api/tacticalrmm/accounts/management/commands/delete_tokens.py @@ -0,0 +1,10 @@ +from django.core.management.base import BaseCommand +from knox.models import AuthToken + + +class Command(BaseCommand): + help = "Deletes all knox tokens" + + def handle(self, *args, **kwargs): + AuthToken.objects.all().delete() + self.stdout.write("All tokens have been deleted!") diff --git a/update.sh b/update.sh index 88e9202e..2fff581c 100644 --- a/update.sh +++ b/update.sh @@ -14,6 +14,7 @@ cd /home/${USER}/rmm/api/tacticalrmm pip install -r /home/${USER}/rmm/api/tacticalrmm/requirements.txt python manage.py makemigrations python manage.py migrate +python manage.py delete_tokens deactivate