perf: Client login

This commit is contained in:
feng
2024-12-18 17:25:40 +08:00
committed by feng626
parent 3cd68ba0a9
commit 7a9a71197a
17 changed files with 83 additions and 29 deletions

View File

@@ -1,8 +1,18 @@
# -*- coding: utf-8 -*-
#
from urllib.parse import urlencode, parse_qsl
from django.shortcuts import reverse, redirect
def redirect_to_guard_view(comment=''):
continue_url = reverse('authentication:login-guard') + '?_=' + comment
def redirect_to_guard_view(comment='', query_string=None):
params = {'_': comment}
base_url = reverse('authentication:login-guard')
if query_string:
params.update(dict(parse_qsl(query_string)))
query_string = urlencode(params)
continue_url = f"{base_url}?{query_string}"
return redirect(continue_url)