add mgmt command to get mesh login url
This commit is contained in:
parent
1a325a66b4
commit
35c8b4f535
|
@ -0,0 +1,19 @@
|
||||||
|
from django.core.management.base import BaseCommand
|
||||||
|
from meshctrl.utils import get_login_token
|
||||||
|
|
||||||
|
from core.utils import get_core_settings
|
||||||
|
|
||||||
|
|
||||||
|
class Command(BaseCommand):
|
||||||
|
help = "generate a url to login to mesh as the superuser"
|
||||||
|
|
||||||
|
def handle(self, *args, **kwargs):
|
||||||
|
|
||||||
|
core = get_core_settings()
|
||||||
|
|
||||||
|
token = get_login_token(key=core.mesh_token, user=f"user//{core.mesh_username}")
|
||||||
|
token_param = f"login={token}&"
|
||||||
|
|
||||||
|
control = f"{core.mesh_site}/?{token_param}"
|
||||||
|
|
||||||
|
self.stdout.write(self.style.SUCCESS(control))
|
Loading…
Reference in New Issue