func (user *User) Validate() (map[string] interface{}, bool) {

	if !strings.Contains(user.Email, "@") {
		return u.Message(false, "Email address is required"), false
	}

	if len(user.Password) < 6 {
		return u.Message(false, "Password is required"), false
	}

	//Email must be unique
	temp := &User{}

	//check for errors and duplicate emails
	err := GetDB().Table("accounts").Where("email = ?", user.Email).First(temp).Error
	if err != nil && err != gorm.ErrRecordNotFound {
		return u.Message(false, "Connection error. Please retry"), false
	}
	if temp.Email != "" {
		return u.Message(false, "Email address already in use by another user."), false
	}

	return u.Message(false, "Requirement passed"), true
}
//Validate incoming user details...
Validate incoming user details
// Validate incoming user details ...
func (user *User) Validate() (map[string] interface{}, bool) {
	if !strings.Contains(user.Email, "@") {
		return u.Message(false, "Email address is required"), false
	}
	if len(user.Password) < 6 {
		return u.Message(false, "Password is required"), false
	}
	temp := &User{}
	err := GetDB().Table("accounts").Where("email = ?", user.Email).First(temp).Error
	if err != nil && err != gorm.ErrRecordNotFound {
		return u.Message(false, "Connection error. Please retry"), false
	}
	if temp.Email != "" {
		return u.Message(false, "Email address already in use by another user."), false
	}
	return u.Message(false, "Requirement passed"), true
}
func ( user * User ) Validate ( ) ( map [ string ] interface { } , bool ) { if ! strings . Contains ( user . Email , " " ) { return u . Message ( false , " " ) , false } if len ( user . Password ) < 6 { return u . Message ( false , " " ) , false } temp := & User { } err := GetDB ( ) . Table ( " " ) . Where ( " " , user . Email ) . First ( temp ) . Error if err != nil && err != gorm . ErrRecordNotFound { return u . Message ( false , " " ) , false } if temp . Email != " " { return u . Message ( false , " " ) , false } return u . Message ( false , " " ) , true }
Validate incoming user details
Validate incoming user details
//Email must be unique //check for errors and duplicate emails