Skip to content

Commit

Permalink
Fixed session check during org change
Browse files Browse the repository at this point in the history
  • Loading branch information
frikky committed May 10, 2024
1 parent 1938def commit 9172e72
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions shared.go
Original file line number Diff line number Diff line change
Expand Up @@ -8594,12 +8594,9 @@ func HandleChangeUserOrg(resp http.ResponseWriter, request *http.Request) {

// Just getting here for later
ctx := GetContext(request)
user, err := HandleApiAuthentication(resp, request)
if err != nil {
log.Printf("[WARNING] Api authentication failed in change org: %s", err)
resp.WriteHeader(401)
resp.Write([]byte(`{"success": false}`))
return
user, userErr := HandleApiAuthentication(resp, request)
if userErr != nil {
log.Printf("[AUDIT] Api authentication failed in change org (local): %s", userErr)
}

if project.Environment == "cloud" {
Expand Down Expand Up @@ -8632,6 +8629,12 @@ func HandleChangeUserOrg(resp http.ResponseWriter, request *http.Request) {
}
}

if userErr != nil {
resp.WriteHeader(401)
resp.Write([]byte(`{"success": false}`))
return
}

body, err := ioutil.ReadAll(request.Body)
if err != nil {
resp.WriteHeader(401)
Expand Down

0 comments on commit 9172e72

Please sign in to comment.