Ejemplo n.º 1
0
func checkIsErr(r *http.Request) bool {
	//とりあえず正規表現チェック
	//check id that is match policy
	mErrList.Id = valid.SetError(r.Form.Get(loginId), valid.Nonzero, valid.Min4, valid.Max12, valid.Ran)
	//check Password that is match policy
	mErrList.Password = valid.SetError(r.Form.Get(loginPassword), valid.Nonzero, valid.Min4, valid.Max12, valid.Ran)
	//とりあえず正規表現エラーチェック
	if mErrList.IsErr = isErrorcheckErrlist(); mErrList.IsErr {
		mErrList.ErrDescription = "something wrong"
		return mErrList.IsErr
	}
	//存在チェック
	var md5Pass string = D.GetMd5Hash(r.Form.Get(loginPassword))
	checkDuplicate := fmt.Sprintf("SELECT user.id FROM user where idUser=\"%s\", password=\"%s\"", r.Form.Get(loginId), md5Pass)
	if mErrList.IsErr = !connectdb.IsDuplicate(checkDuplicate); mErrList.IsErr {
		log.Println("err %v", mErrList.IsErr)
		mErrList.ErrDescription = "something wrong"
	}
	return mErrList.IsErr
}
Ejemplo n.º 2
0
//<summary>実際にエラーがあるかどうか</summary>
func checkIsError() bool {
	errList.Id = valid.SetError(id, valid.Nonzero, valid.Min4, valid.Max12, valid.Ran)
	errList.Password = valid.SetError(password1, valid.Nonzero, valid.Min4, valid.Max12, valid.Ran)
	errList.Password2 = valid.SetError(password2, valid.Nonzero, valid.Min4, valid.Max12, valid.Ran)
	errList.Name = valid.SetError(name, valid.Nonzero, valid.Max18, valid.Ra)
	errList.Gender = valid.SetError(gender, valid.Rn)
	errList.Age = valid.SetError(age, valid.Rn, valid.Min2, valid.Max2)
	//パスワードが一緒かどうか
	if password1 != password2 {
		errList.Password2 = "Err : the password is not same"
	}
	//同じidが存在しないかどうか
	checkDoplicate := fmt.Sprintf("SELECT user.id FROM user where idUser=\"%v\"", id)
	if connectdb.IsDuplicate(checkDoplicate) {
		errList.Id = "There are duplicate"
	}
	errList.IsErr = isErrorcheckErrlist()
	return errList.IsErr
}