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)
defer stmt.Close()
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 {
// search failed user not real
c.IndentedJSON(http.StatusNotFound, userData)
panic(err)
return
}
if user.Password != userData.Password {
// user not real
c.IndentedJSON(http.StatusNotFound, userData)
panic(err)
return
} else {
// user is in
@@ -176,9 +178,6 @@ func main() {
})
router.Static("/frontend", "./frontend")
// asset routes
router.Static("/scripts", "./scripts")
router.Run("localhost:8080")
}