Skip to content

Commit

Permalink
add get IP from context
Browse files Browse the repository at this point in the history
  • Loading branch information
Lukmanern committed Oct 24, 2023
1 parent b8f06ba commit a5927bc
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion controller/user_auth/user_auth_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,12 @@ func NewUserAuthController(service service.UserAuthService) UserAuthController {
}

func (ctr UserAuthControllerImpl) Login(c *fiber.Ctx) error {
// Todo : implement Max Retry/Jail in Login -> caching using Redis
var user model.UserLogin
// user.IP = c.IP() // Todo : update it in production
if err := c.BodyParser(&user); err != nil {
return response.BadRequest(c, "invalid json body: "+err.Error())
}

userIP := net.ParseIP(user.IP)
if userIP == nil {
return response.BadRequest(c, "invalid json body: invalid user ip address")
Expand Down

0 comments on commit a5927bc

Please sign in to comment.