From e345e12ae69042dda4f290ddcf35daf0cc7fa3f9 Mon Sep 17 00:00:00 2001 From: Michele Stravs Date: Thu, 17 Aug 2023 10:01:36 +0200 Subject: [PATCH] Fixed POST target and redirection URL, fixing #25 --- datasette_auth_passwords/__init__.py | 2 +- datasette_auth_passwords/templates/password_login.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/datasette_auth_passwords/__init__.py b/datasette_auth_passwords/__init__.py index 08f067c..ea47dfb 100644 --- a/datasette_auth_passwords/__init__.py +++ b/datasette_auth_passwords/__init__.py @@ -42,7 +42,7 @@ async def password_login(request, datasette): password_hash = accounts.get(username) if password_hash and verify_password(password, password_hash): actor = actors.get(username) or {"id": username} - response = Response.redirect("/") + response = Response.redirect(datasette.urls.path("/")) response.set_cookie("ds_actor", datasette.sign({"a": actor}, "actor")) return response else: diff --git a/datasette_auth_passwords/templates/password_login.html b/datasette_auth_passwords/templates/password_login.html index ba201d1..f0c2bec 100644 --- a/datasette_auth_passwords/templates/password_login.html +++ b/datasette_auth_passwords/templates/password_login.html @@ -28,7 +28,7 @@

Log in

{{ error }}

{% endif %} -
+