From 37ad2d6a67070222f57ed31b1da7e867bd123d54 Mon Sep 17 00:00:00 2001 From: array-in-a-matrix Date: Wed, 24 Jul 2024 15:15:07 -0400 Subject: [PATCH] newsession returns json --- src/routes/auth.nim | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/routes/auth.nim b/src/routes/auth.nim index b229efd..744d406 100644 --- a/src/routes/auth.nim +++ b/src/routes/auth.nim @@ -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" +