Fix various issues

This commit is contained in:
Tracker-Friendly 2024-04-26 21:39:57 +01:00 committed by arzumify
parent 7579d35b4a
commit 5d3022f1cc
1 changed files with 4 additions and 5 deletions

View File

@ -8,7 +8,6 @@ import (
"fmt" "fmt"
"io/ioutil" "io/ioutil"
"math/rand" "math/rand"
"net/url"
"os" "os"
"regexp" "regexp"
"strconv" "strconv"
@ -380,7 +379,7 @@ func main() {
conn.QueryRow("SELECT appId, rdiruri FROM oauth WHERE appId = ? LIMIT 1", appId).Scan(&appidcheck, &rdiruricheck) 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") c.String(401, "Redirect URI does not match")
return return
} }
@ -432,9 +431,9 @@ func main() {
var verifycode bool var verifycode bool
if code_verify == "" { if code_verify == "" {
verifycode = true
} else {
verifycode = false verifycode = false
} else {
verifycode = true
} }
conn := get_db_connection() 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) { router.POST("/api/deleteauth", func(c *gin.Context) {