From e9b05fa4f44fa2c8e561595579a2f4810f763ae5 Mon Sep 17 00:00:00 2001 From: s3lph Date: Sat, 7 Dec 2024 22:15:48 +0100 Subject: [PATCH] fix: keep buypid when wrong touchkey is entered --- matemat/webserver/pagelets/touchkey.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/matemat/webserver/pagelets/touchkey.py b/matemat/webserver/pagelets/touchkey.py index 1164b1b..2baa9ad 100644 --- a/matemat/webserver/pagelets/touchkey.py +++ b/matemat/webserver/pagelets/touchkey.py @@ -45,7 +45,10 @@ def touchkey_page(): user: User = db.login(str(request.params.username), touchkey=str(request.params.touchkey)) except AuthenticationError: # Reload the touchkey login page on failure - redirect(f'/touchkey?uid={str(request.params.uid)}&username={str(request.params.username)}') + url = f'/touchkey?uid={str(request.params.uid)}&username={str(request.params.username)}' + if request.params.buypid: + url += f'&buypid={request.params.buypid}' + redirect(url) # Set the user ID session variable session.put(session_id, 'authenticated_user', user.id) # Set the authlevel session variable (0 = none, 1 = touchkey, 2 = password login)