Example #1
0
func (this *User) ValidatePassword(v *r.Validation, password string) {
	bin := []byte(_APPSECRET + password + this.Username)
	hbin, _ := base64.StdEncoding.DecodeString(this.Password)
	err := bcrypt.CompareHashAndPassword(hbin, bin)
	if err != nil {
		v.Error("密码不匹配")
	}
}
Example #2
0
File: user.go Project: puspesh/cdfs
func (user *User) Validate(v *revel.Validation) {
	v.Required(user.Password)
	//v.MinSize(user.Password, 6)
	v.Required(user.Email)
	v.Email(user.Email)

	if user.Email == "*****@*****.**" && user.Password == "test" {
		user.Id = "6964943e-535a-4736-85ad-4baaa9656709"
	} else {
		v.Error("Sorry! invalid account ...")
	}
}