feat: add auth login validator

master
fbonhomm 2019-08-25 17:15:54 +02:00
parent f50b464b8a
commit 0011b99bb8
1 changed files with 27 additions and 0 deletions

27
source/validators/auth.go Normal file
View File

@ -0,0 +1,27 @@
/**
* Created by fbonhomm
* Email: flo-github@outlook.fr
* Licence: MIT
*/
package validators
import (
"github.com/gin-gonic/gin"
"github.com/gin-gonic/gin/binding"
)
type authLogin struct {
Email string `form:"email" binding:"required,email"`
Password string `form:"password" binding:"required,min=8,max=50"`
}
// ValidateAuthLogin
func ValidateAuthLogin(c *gin.Context) {
var v authLogin
if err := c.ShouldBindWith(&v, binding.FormPost); err != nil {
errorHandling(c, err.Error())
}
}