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)
|
||||
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")
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user