Fixed sql error
This commit is contained in:
7
main.go
7
main.go
@@ -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")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user