Skip to content

Commit

Permalink
fix: include Referer header in user-related API requests
Browse files Browse the repository at this point in the history
  • Loading branch information
seanmorley15 committed Jan 18, 2025
1 parent 75162bb commit 1a7643b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion frontend/src/routes/settings/+page.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,8 @@ export const actions: Actions = {

const resCurrent = await fetch(`${endpoint}/auth/user-metadata/`, {
headers: {
Cookie: `sessionid=${sessionId}`
Cookie: `sessionid=${sessionId}`,
Referer: event.url.origin // Include Referer header
}
});

Expand Down Expand Up @@ -158,6 +159,7 @@ export const actions: Actions = {
let res = await fetch(`${endpoint}/auth/update-user/`, {
method: 'PATCH',
headers: {
Referer: event.url.origin, // Include Referer header
Cookie: `sessionid=${sessionId}; csrftoken=${csrfToken}`,
'X-CSRFToken': csrfToken
},
Expand Down Expand Up @@ -209,6 +211,7 @@ export const actions: Actions = {
let res = await fetch(`${endpoint}/_allauth/browser/v1/account/password/change`, {
method: 'POST',
headers: {
Referer: event.url.origin, // Include Referer header
Cookie: `sessionid=${sessionId}; csrftoken=${csrfToken}`,
'X-CSRFToken': csrfToken,
'Content-Type': 'application/json'
Expand All @@ -226,6 +229,7 @@ export const actions: Actions = {
let res = await fetch(`${endpoint}/_allauth/browser/v1/account/password/change`, {
method: 'POST',
headers: {
Referer: event.url.origin, // Include Referer header
Cookie: `sessionid=${sessionId}; csrftoken=${csrfToken}`,
'X-CSRFToken': csrfToken,
'Content-Type': 'application/json'
Expand Down Expand Up @@ -258,6 +262,7 @@ export const actions: Actions = {
let res = await fetch(`${endpoint}/auth/change-email/`, {
method: 'POST',
headers: {
Referer: event.url.origin, // Include Referer header
Cookie: `sessionid=${sessionId}; csrftoken=${csrfToken}`,
'Content-Type': 'application/json',
'X-CSRFToken': csrfToken
Expand Down

0 comments on commit 1a7643b

Please sign in to comment.