Revert "Made the JSON marshal and unmarshal properly"
This reverts commit 10c6848c5c
.
This commit is contained in:
parent
73506b8aee
commit
2f49361c76
13
main.go
13
main.go
|
@ -12,7 +12,6 @@ import (
|
||||||
"encoding/base64"
|
"encoding/base64"
|
||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
"encoding/json"
|
|
||||||
"encoding/pem"
|
"encoding/pem"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
@ -933,14 +932,7 @@ func main() {
|
||||||
"PKCECode": code,
|
"PKCECode": code,
|
||||||
"PKCEMethod": codeMethod,
|
"PKCEMethod": codeMethod,
|
||||||
}
|
}
|
||||||
|
session.Set("activeLogin", sessionInfo)
|
||||||
sessionInfoStr, err := json.Marshal(sessionInfo)
|
|
||||||
if err != nil {
|
|
||||||
log.Println("[ERROR] Unknown in /api/auth sessionInfoStr at", strconv.FormatInt(time.Now().Unix(), 10)+":", err)
|
|
||||||
c.String(500, "Something went wrong on our end. Please report this bug at https://centrifuge.hectabit.org/hectabit/burgerauth and refer to the docs for more info. Your error code is: UNKNOWN-API-AUTH-SESSIONINFO.")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
session.Set("activeLogin", sessionInfoStr)
|
|
||||||
err = session.Save()
|
err = session.Save()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println("[ERROR] Client-Server unknown in /api/auth session save at", strconv.FormatInt(time.Now().Unix(), 10)+":", err)
|
log.Println("[ERROR] Client-Server unknown in /api/auth session save at", strconv.FormatInt(time.Now().Unix(), 10)+":", err)
|
||||||
|
@ -1000,8 +992,7 @@ func main() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
var activeLoginMap map[string]any
|
activeLoginMap := activeLogin.(map[string]any)
|
||||||
err = json.Unmarshal([]byte(activeLogin.(string)), &activeLoginMap)
|
|
||||||
openid, loginCode, PKCECode, PKCEMethod := activeLoginMap["openid"].(string), activeLoginMap["session"].(string), activeLoginMap["PKCECode"].(string), activeLoginMap["PKCEMethod"].(string)
|
openid, loginCode, PKCECode, PKCEMethod := activeLoginMap["openid"].(string), activeLoginMap["session"].(string), activeLoginMap["PKCECode"].(string), activeLoginMap["PKCEMethod"].(string)
|
||||||
if loginCode != code {
|
if loginCode != code {
|
||||||
c.JSON(401, gin.H{"error": "Another login attempt is in progress or the login was never started"})
|
c.JSON(401, gin.H{"error": "Another login attempt is in progress or the login was never started"})
|
||||||
|
|
Reference in New Issue