type Registrat struct {
Username string `form:"username"`
Phone string `form:"phone"`
Email string `form:"email"`
Password string `form:"password"`
Title string `form:"title"`
Age uint8 `form:"age"`
Height uint8 `form:"height"`
Weight uint8 `form:"weight"`
Body uint8 `form:"body"`
}
func registration(data Registrat) (*Registrat, error) {
if !isPasswordValid(&data.Password) {
return &data, errors.New("incorrect password")
}
return &data, nil
}
func isPasswordValid(password *Registrat.Password) bool {
if len(password) < 8 || len(password) > 128 {
return false
}
}