From 30fef390f55fd8c23ade69c54a0357a46945ac18 Mon Sep 17 00:00:00 2001 From: Rocka Date: Thu, 5 Apr 2018 23:10:46 +0800 Subject: [PATCH] fix: admin and demo view redirect issue --- isso/views/comments.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/isso/views/comments.py b/isso/views/comments.py index d3b80c3..bfebb3f 100644 --- a/isso/views/comments.py +++ b/isso/views/comments.py @@ -843,14 +843,19 @@ class API(object): return JSON({'text': self.isso.render(data["text"])}, 200) def demo(self, env, req): - return redirect(get_current_url(env) + '/index.html') + return redirect( + get_current_url(env, strip_querystring=True) + '/index.html' + ) def login(self, env, req): data = req.form password = self.isso.conf.get("general", "admin_password") if data['password'] and data['password'] == password: - response = redirect(get_current_url( - env, host_only=True) + '/admin') + response = redirect(re.sub( + r'/login$', + '/admin', + get_current_url(env, strip_querystring=True) + )) cookie = functools.partial(dump_cookie, value=self.isso.sign({"logged": True}), expires=datetime.now() + timedelta(1))