From 5d3022f1cc1ad1ff4a232c9c9211f6b3f82893a8 Mon Sep 17 00:00:00 2001 From: Arzumify Date: Fri, 26 Apr 2024 21:39:57 +0100 Subject: [PATCH] Fix various issues --- main.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/main.go b/main.go index f4e8b98..6eec2c2 100644 --- a/main.go +++ b/main.go @@ -8,7 +8,6 @@ import ( "fmt" "io/ioutil" "math/rand" - "net/url" "os" "regexp" "strconv" @@ -380,7 +379,7 @@ func main() { conn.QueryRow("SELECT appId, rdiruri FROM oauth WHERE appId = ? LIMIT 1", appId).Scan(&appidcheck, &rdiruricheck) - if !(rdiruricheck == url.QueryEscape(redirect_uri)) { + if !(rdiruricheck == redirect_uri) { c.String(401, "Redirect URI does not match") return } @@ -432,9 +431,9 @@ func main() { var verifycode bool if code_verify == "" { - verifycode = true - } else { verifycode = false + } else { + verifycode = true } conn := get_db_connection() @@ -475,7 +474,7 @@ func main() { } } - c.JSON(401, gin.H{"access_token": logincode, "token_type": "bearer", "expires_in": 2592000, "id_token": openid}) + c.JSON(200, gin.H{"access_token": logincode, "token_type": "bearer", "expires_in": 2592000, "id_token": openid}) }) router.POST("/api/deleteauth", func(c *gin.Context) {