mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
chore: after signout intead of redirecting to login page we are navigating to the same page where he logged out (#4507)
This commit is contained in:
parent
e3e7c99e11
commit
6f05ec7e74
@ -12,6 +12,8 @@ from plane.db.models import User
|
|||||||
class SignOutAuthSpaceEndpoint(View):
|
class SignOutAuthSpaceEndpoint(View):
|
||||||
|
|
||||||
def post(self, request):
|
def post(self, request):
|
||||||
|
next_path = request.POST.get("next_path")
|
||||||
|
|
||||||
# Get user
|
# Get user
|
||||||
try:
|
try:
|
||||||
user = User.objects.get(pk=request.user.id)
|
user = User.objects.get(pk=request.user.id)
|
||||||
@ -20,10 +22,8 @@ class SignOutAuthSpaceEndpoint(View):
|
|||||||
user.save()
|
user.save()
|
||||||
# Log the user out
|
# Log the user out
|
||||||
logout(request)
|
logout(request)
|
||||||
return HttpResponseRedirect(
|
url = f"{base_host(request=request, is_space=True)}{next_path}"
|
||||||
base_host(request=request, is_space=True)
|
return HttpResponseRedirect(url)
|
||||||
)
|
|
||||||
except Exception:
|
except Exception:
|
||||||
return HttpResponseRedirect(
|
url = f"{base_host(request=request, is_space=True)}{next_path}"
|
||||||
base_host(request=request, is_space=True)
|
return HttpResponseRedirect(url)
|
||||||
)
|
|
||||||
|
@ -98,6 +98,7 @@ export const UserAvatar: FC = observer(() => {
|
|||||||
{csrfToken && (
|
{csrfToken && (
|
||||||
<form method="POST" action={`${API_BASE_URL}/auth/spaces/sign-out/`} onSubmit={signOut}>
|
<form method="POST" action={`${API_BASE_URL}/auth/spaces/sign-out/`} onSubmit={signOut}>
|
||||||
<input type="hidden" name="csrfmiddlewaretoken" value={csrfToken} />
|
<input type="hidden" name="csrfmiddlewaretoken" value={csrfToken} />
|
||||||
|
<input type="hidden" name="next_path" value={`${pathName}?${queryParam}`} />
|
||||||
<button
|
<button
|
||||||
type="submit"
|
type="submit"
|
||||||
className="flex items-center gap-2 rounded p-2 whitespace-nowrap hover:bg-custom-background-80 text-sm min-w-36 cursor-pointer"
|
className="flex items-center gap-2 rounded p-2 whitespace-nowrap hover:bg-custom-background-80 text-sm min-w-36 cursor-pointer"
|
||||||
|
Loading…
Reference in New Issue
Block a user