ayushman #14

Merged
cereci5049 merged 2 commits from ayushman into main 2024-08-07 22:30:15 +02:00
2 changed files with 7 additions and 4 deletions
Showing only changes of commit fef48d9535 - Show all commits

View file

@ -42,15 +42,15 @@ import
"/login" -> get:
compileTemplateFile(getScriptDir() / "view" / "login.nimja")
"/login" -> post:
"/htmx/login" -> post:
var em =ctx.urlForm["email"]
var ps=ctx.urlForm["password"]
let conn=newTurso()
var temp=getUser(conn, em, ps)
if temp[0]:
echo $(%* temp[1])
ctx &= initCookie("user", $(%* temp[1]))
ctx.redirect("/")
# redirect using HX-Redict to / url
ctx.response.headers.add("HX-Redirect", "/")
else:
echo "user not found"

View file

@ -8,7 +8,10 @@
<div class="col">
<h1 class="mt-5">Login</h1>
<form id="input_form" method="post" class="" novalidate>
<form id="input_form" class="" novalidate
hx-trigger="submit"
hx-post="/htmx/login"
>
<label class="text-danger"></label>
<div class="form-group mt-5">