fixed login
This commit is contained in:
@@ -15,7 +15,7 @@ func Run() {
|
||||
private := r.Group("/")
|
||||
private.Use(userIsAuthorized)
|
||||
|
||||
private.PATCH("/login", user) //change username/password (required before adding bots)
|
||||
private.PATCH("/login", updateLogin) //change username/password (required before adding bots)
|
||||
|
||||
private.GET("/bots", func(c *gin.Context) {}) //generalized list of bots
|
||||
private.GET("/bot/:bot", func(c *gin.Context) {}) //specific bot
|
||||
|
||||
@@ -32,4 +32,14 @@ func login(c *gin.Context) {
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
func updateLogin(c *gin.Context) {
|
||||
var updateLogin LoginBody
|
||||
if err := c.BindJSON(&updateLogin); err != nil {
|
||||
fmt.Println(err)
|
||||
return
|
||||
}
|
||||
storage.UpdateUsername(updateLogin.Username)
|
||||
storage.UpdatePassword(updateLogin.Password)
|
||||
}
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
package endpoints
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"git.zomo.dev/zomo/discord-retokenizer/storage"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
func user(c *gin.Context) {
|
||||
var updateLogin LoginBody
|
||||
if err := c.BindJSON(&updateLogin); err != nil {
|
||||
fmt.Println(err)
|
||||
return
|
||||
}
|
||||
storage.UpdateUsername(updateLogin.Username)
|
||||
storage.UpdatePassword(updateLogin.Password)
|
||||
}
|
||||
Reference in New Issue
Block a user