v1.0.0: import: import code from accounts
Signed-off-by: GnomeZworc <nicolas.boufidjeline@g3e.fr>
This commit is contained in:
parent
40c43c6726
commit
7f7fd9395c
8 changed files with 369 additions and 0 deletions
21
cmd/login.go
Normal file
21
cmd/login.go
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/labstack/echo/v4"
|
||||
logins "gitlab.g3e.fr/h6n/users/internal"
|
||||
)
|
||||
|
||||
func login(c echo.Context) error {
|
||||
var request logins.RequestLogin
|
||||
if err := c.Bind(&request); err != nil {
|
||||
return c.JSON(http.StatusBadRequest, err)
|
||||
}
|
||||
|
||||
if response, err := logins.CreateLogin(db, request); err != nil {
|
||||
return c.JSON(http.StatusBadRequest, "Not a valide user username or password")
|
||||
} else {
|
||||
return c.JSON(http.StatusOK, response)
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue