MCPcopy Create free account
hub / github.com/devinterface/startersaas-go-api / Login

Method Login

endpoints/auth.endpoint.go:15–33  ·  view source on GitHub ↗

Login function

(ctx *fiber.Ctx)

Source from the content-addressed store, hash-verified

13
14// Login function
15func (authEndpoint *AuthEndpoint) Login(ctx *fiber.Ctx) error {
16 var inputMap = make(map[string]interface{})
17 ctx.BodyParser(&inputMap)
18 v := validate.Map(inputMap)
19 v.StringRule("email", "email|required")
20 v.StringRule("password", "required")
21
22 if !v.Validate() {
23 return ctx.Status(422).JSON(v.Errors)
24 }
25 response, err := authService.Login(inputMap["email"].(string), inputMap["password"].(string), false)
26 if err != nil {
27 return ctx.Status(401).JSON(fiber.Map{
28 "message": err.Error(),
29 })
30
31 }
32 return ctx.JSON(response)
33}
34
35// SsoLogin function
36func (authEndpoint *AuthEndpoint) SsoLogin(ctx *fiber.Ctx) error {

Callers 1

RefreshTokenMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected