Remove un-used route
This commit is contained in:
@@ -122,38 +122,6 @@ func StartEcho(server chan bool, webserver_addr string, webserver_port int) {
|
||||
return c.String(http.StatusOK, "OK - "+printJob)
|
||||
})
|
||||
|
||||
e.POST("/login", func(c echo.Context) error {
|
||||
|
||||
username := c.FormValue("username")
|
||||
password := c.FormValue("password")
|
||||
|
||||
// Throws unauthorized error
|
||||
if username != "test" || password != "login" {
|
||||
return echo.ErrUnauthorized
|
||||
}
|
||||
|
||||
// Set custom claims
|
||||
claims := &jwtCustomClaims{
|
||||
jwt.RegisteredClaims{
|
||||
ExpiresAt: jwt.NewNumericDate(time.Now().Add(time.Hour * 72)),
|
||||
},
|
||||
}
|
||||
|
||||
// Create token with claims
|
||||
token := jwt.NewWithClaims(jwt.SigningMethodHS256, claims)
|
||||
|
||||
// Generate encoded token and send it as response.
|
||||
t, err := token.SignedString([]byte("secret"))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return c.JSON(http.StatusOK, echo.Map{
|
||||
"token": t,
|
||||
})
|
||||
|
||||
}).Name = "Login"
|
||||
|
||||
e.GET("/robots.txt", func(c echo.Context) error {
|
||||
return c.String(http.StatusOK, "User-agent: *\nDisallow:\n")
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user