diff --git a/internal/photos/api/account.go b/internal/photos/api/account.go index bfa6a8c..97b94e6 100644 --- a/internal/photos/api/account.go +++ b/internal/photos/api/account.go @@ -8,7 +8,6 @@ import ( "time" "github.com/gin-gonic/gin" - "gopkg.in/validator.v2" "gorm.io/gorm" ) @@ -52,8 +51,8 @@ func NewAccount(login string, password string) *Account { // Service type SignupOrLoginRequest struct { - Login string `validate:"min=3,max=40,regexp=^[a-zA-Z0-9]*$"` - Password string `validate:"min=8,max=40"` + Login string `binding:"min=3,max=40,alphanum"` + Password string `binding:"min=8,max=40"` } func (s *Service) Signup(c *gin.Context) { @@ -62,10 +61,6 @@ func (s *Service) Signup(c *gin.Context) { if c.BindJSON(&account) != nil { return } - if err := validator.Validate(account); err != nil { - c.AbortWithError(http.StatusExpectationFailed, err) - return - } var accountExists int64 if err := s.DB.Model(&Account{}).Where("login = ?", account.Login).Count(&accountExists).Error; err != nil {