func (h *Handler) Verify(c echo.Context) (err error) {
	// Bind
	u := new(model.User)
	if err = c.Bind(u); err != nil {
		return
	}

	email := c.QueryParam("e")
	verifyKey := c.QueryParam("k")

	// Find user
	db := h.DB.Clone()
	defer db.Close()

	// numRows, err := db.DB(config.DbName).C("users").Find(bson.M{"email": email, "verifyKey": verifyKey}).Count()
	// log.Println(numRows)
	// if numRows < 1 || err == mgo.ErrNotFound {
	// 	return &echo.HTTPError{Code: http.StatusUnauthorized, Message: "invalid link or token already expired"}
	// }

	if err = db.DB(config.DbName).C("users").Find(bson.M{"email": email, "verifyKey": verifyKey}).One(u); err != nil {
		return &echo.HTTPError{Code: http.StatusUnauthorized, Message: "invalid link or token already expired"}
	}

	if err = db.DB(config.DbName).C("users").
		UpdateId(u.ID, bson.M{"$set": bson.M{"verifyKey": "", "status": "Verified"}}); err != nil {
		if err == mgo.ErrNotFound {
			return echo.ErrNotFound
		}
	}

	return c.JSON(http.StatusOK, "ok")
}
//Verify to verify user (clicked by user in email)
Verify to verify user (clicked by user in email)
// Verify to verify user ( clicked by user in email )
func (h *Handler) Verify(c echo.Context) (err error) {
	u := new(model.User)
	if err = c.Bind(u); err != nil {
		return
	}
	email := c.QueryParam("e")
	verifyKey := c.QueryParam("k")
	db := h.DB.Clone()
	defer db.Close()
	if err = db.DB(config.DbName).C("users").Find(bson.M{"email": email, "verifyKey": verifyKey}).One(u); err != nil {
		return &echo.HTTPError{Code: http.StatusUnauthorized, Message: "invalid link or token already expired"}
	}
	if err = db.DB(config.DbName).C("users").
		UpdateId(u.ID, bson.M{"$set": bson.M{"verifyKey": "", "status": "Verified"}}); err != nil {
		if err == mgo.ErrNotFound {
			return echo.ErrNotFound
		}
	}
	return c.JSON(http.StatusOK, "ok")
}
func ( h * Handler ) Verify ( c echo . Context ) ( err error ) { u := new ( model . User ) if err = c . Bind ( u ) ; err != nil { return } email := c . QueryParam ( " " ) verifyKey := c . QueryParam ( " " ) db := h . DB . Clone ( ) defer db . Close ( ) if err = db . DB ( config . DbName ) . C ( " " ) . Find ( bson . M { " " : email , " " : verifyKey } ) . One ( u ) ; err != nil { return & echo . HTTPError { Code : http . StatusUnauthorized , Message : " " } } if err = db . DB ( config . DbName ) . C ( " " ) . UpdateId ( u . ID , bson . M { " " : bson . M { " " : " " , " " : " " } } ) ; err != nil { if err == mgo . ErrNotFound { return echo . ErrNotFound } } return c . JSON ( http . StatusOK , " " ) }
Verify to verify user (clicked by user in email)
Verify to verify user ( clicked by user in email )
// Bind // Find user // numRows, err := db.DB(config.DbName).C("users").Find(bson.M{"email": email, "verifyKey": verifyKey}).Count() // log.Println(numRows) // if numRows < 1 || err == mgo.ErrNotFound { // 	return &echo.HTTPError{Code: http.StatusUnauthorized, Message: "invalid link or token already expired"} // }