Skip to content

Commit 6439cb6

Browse files
committed
wip debug failing login
1 parent d00fd7a commit 6439cb6

File tree

9 files changed

+26
-4981
lines changed

9 files changed

+26
-4981
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
20.9.0

clients-side/frontend/prompt-smith-frontend/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Credits: https://github.com/vercel/next.js/blob/canary/examples/with-docker/Dockerfile
22

3-
FROM node:20-alpine AS base
3+
FROM node:20.9.0-alpine AS base
44

55
# Install dependencies only when needed
66
FROM base AS deps

clients-side/frontend/prompt-smith-frontend/components/features/login-form.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,9 @@ const LoginForm = () => {
8181

8282
useEffect(() => {
8383
setError(null)
84-
init()
84+
init().then(() => {
85+
console.log('init csrf')
86+
})
8587
}, [])
8688

8789

clients-side/frontend/prompt-smith-frontend/lib/auth/cookieUtils.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import {ORG_COOKIE_NAME, PROJECT_COOKIE_NAME, SESSION_AGE} from "@/lib/constants"; // shared configuation file between frontend and backend
2+
import {init} from "./authAPIWrapper";
23

34

45
/**
@@ -38,5 +39,18 @@ export const setCookieOrgUUID = (uuid: string) => {
3839

3940

4041
export function getCSRFToken() {
41-
return getCookie('csrftoken')
42+
const csrfCookie = getCookie('csrftoken')
43+
if (csrfCookie) {
44+
return csrfCookie
45+
} else {
46+
console.error('CSRF cookie not found')
47+
init().then(
48+
() => {
49+
return getCookie('csrftoken')
50+
},
51+
(e) => {
52+
console.error('CSRF cookie refresh 2nd time failed', e)
53+
}
54+
)
55+
}
4256
}

0 commit comments

Comments
 (0)