Fixed sql error

This commit is contained in:
2023-07-17 17:42:33 +01:00
parent b704db1ba1
commit 3761fc1b1e
2 changed files with 3 additions and 4 deletions

BIN
main

Binary file not shown.

View File

@@ -58,15 +58,17 @@ func login(c *gin.Context) {
checkErr(err) checkErr(err)
defer stmt.Close() defer stmt.Close()
var user loginOutput var user loginOutput
err = stmt.QueryRow(userData.Name).Scan(&user.Name, &user.Password, &user.UID, &user.Role) err = stmt.QueryRow(userData.Name).Scan(&user.UID, &user.Name, &user.Password, &user.Role)
if err != nil { if err != nil {
// search failed user not real // search failed user not real
c.IndentedJSON(http.StatusNotFound, userData) c.IndentedJSON(http.StatusNotFound, userData)
panic(err)
return return
} }
if user.Password != userData.Password { if user.Password != userData.Password {
// user not real // user not real
c.IndentedJSON(http.StatusNotFound, userData) c.IndentedJSON(http.StatusNotFound, userData)
panic(err)
return return
} else { } else {
// user is in // user is in
@@ -176,9 +178,6 @@ func main() {
}) })
router.Static("/frontend", "./frontend") router.Static("/frontend", "./frontend")
// asset routes
router.Static("/scripts", "./scripts")
router.Run("localhost:8080") router.Run("localhost:8080")
} }