core: make impersonation's redirect return to shell

This commit is contained in:
Jens Langhammer 2020-11-22 23:40:49 +01:00
parent 02d4118f73
commit c26d928eb0
2 changed files with 5 additions and 5 deletions

View File

@ -23,7 +23,7 @@ class TestImpersonation(TestCase):
) )
) )
response = self.client.get(reverse("passbook_core:overview")) response = self.client.get(reverse("passbook_api:user-me"))
self.assertIn(self.other_user.username, response.content.decode()) self.assertIn(self.other_user.username, response.content.decode())
self.assertNotIn(self.pbadmin.username, response.content.decode()) self.assertNotIn(self.pbadmin.username, response.content.decode())
@ -52,4 +52,4 @@ class TestImpersonation(TestCase):
self.client.force_login(self.other_user) self.client.force_login(self.other_user)
response = self.client.get(reverse("passbook_core:impersonate-end")) response = self.client.get(reverse("passbook_core:impersonate-end"))
self.assertRedirects(response, reverse("passbook_core:overview")) self.assertRedirects(response, reverse("passbook_core:shell"))

View File

@ -33,7 +33,7 @@ class ImpersonateInitView(View):
Event.new(EventAction.IMPERSONATION_STARTED).from_http(request, user_to_be) Event.new(EventAction.IMPERSONATION_STARTED).from_http(request, user_to_be)
return redirect("passbook_core:overview") return redirect("passbook_core:shell")
class ImpersonateEndView(View): class ImpersonateEndView(View):
@ -46,7 +46,7 @@ class ImpersonateEndView(View):
or SESSION_IMPERSONATE_ORIGINAL_USER not in request.session or SESSION_IMPERSONATE_ORIGINAL_USER not in request.session
): ):
LOGGER.debug("Can't end impersonation", user=request.user) LOGGER.debug("Can't end impersonation", user=request.user)
return redirect("passbook_core:overview") return redirect("passbook_core:shell")
original_user = request.session[SESSION_IMPERSONATE_ORIGINAL_USER] original_user = request.session[SESSION_IMPERSONATE_ORIGINAL_USER]
@ -55,4 +55,4 @@ class ImpersonateEndView(View):
Event.new(EventAction.IMPERSONATION_ENDED).from_http(request, original_user) Event.new(EventAction.IMPERSONATION_ENDED).from_http(request, original_user)
return redirect("passbook_core:overview") return redirect("passbook_core:shell")