Merge pull request #411 from Rocket1184/hotfix/demo-and-admin-redirect

fix: admin and demo view redirect issue
This commit is contained in:
Benoît Latinier 2018-04-22 21:35:24 +02:00 committed by GitHub
commit 502747cb75
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -843,14 +843,19 @@ class API(object):
return JSON({'text': self.isso.render(data["text"])}, 200) return JSON({'text': self.isso.render(data["text"])}, 200)
def demo(self, env, req): 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): def login(self, env, req):
data = req.form data = req.form
password = self.isso.conf.get("general", "admin_password") password = self.isso.conf.get("general", "admin_password")
if data['password'] and data['password'] == password: if data['password'] and data['password'] == password:
response = redirect(get_current_url( response = redirect(re.sub(
env, host_only=True) + '/admin') r'/login$',
'/admin',
get_current_url(env, strip_querystring=True)
))
cookie = functools.partial(dump_cookie, cookie = functools.partial(dump_cookie,
value=self.isso.sign({"logged": True}), value=self.isso.sign({"logged": True}),
expires=datetime.now() + timedelta(1)) expires=datetime.now() + timedelta(1))