newsession returns json

This commit is contained in:
array-in-a-matrix 2024-07-24 15:15:07 -04:00
parent 019cf31922
commit 37ad2d6a67

View file

@ -64,4 +64,12 @@ proc createAuthenticationRoutes*() =
db.generateToken(user)
else:
resp Http403, "Incorrect username or password.\n" # fails if password is wrong but mentions username to obfuscates if a user exists or not
resp Http200, user.token & "\n"
var userToken: string
with userToken:
add "[{"
add("\"token\": \"" & user.token & "\"")
add "}]"
resp Http200, userToken & "\n", "application/json"