func (c *UserController) Session() {
	name := c.GetString("name")
	password := c.GetString("password")

	needCheckCaptcha := c.NeedCheckCaptcha()
	if needCheckCaptcha {
		result := c.VerifyCaptcha()
		if !result {
			c.RecordLoginFailTimes()
			c.StringError(exception.CAPTCHA_FALSE.Error())
			c.Data["showLeftBar"] = false
			c.TplName = "login.html"
			return
		}
	}

	user, err := services.FundUser(name, password)
	if err == nil {
		c.SetCurrSession("user", user)
		c.Ctx.Redirect(302, "/")
	} else {
		c.RecordLoginFailTimes()
		c.StringError(exception.USER_NAME_OR_PASS_UNMATCH.Error())
		c.Data["showLeftBar"] = false
		c.TplName = "login.html"
	}
}
func (c *UserController) OauthSession() {
	name := c.GetString("name")
	password := c.GetString("password")

	needCheckCaptcha := c.NeedCheckCaptcha()
	if needCheckCaptcha {
		result := c.VerifyCaptcha()
		if !result {
			c.RecordLoginFailTimes()
			c.StringError(exception.CAPTCHA_FALSE.Error())
			c.OauthLogin()
			return
		}
	}

	user, err := services.FundUser(name, password)
	if err == nil {
		c.SetCurrSession("user", user)
		c.Ctx.Redirect(302, "/")

		openUser := c.CurrentOpenUser()
		beego.Debug("openuser:", openUser)
		var result int64
		if nil != openUser && openUser.UserId == 0 {
			result, err = services.BindUserIdToOpenUser(openUser.OpenId, entities.OPEN_USER_TYPE_QQ, user.Id)
		}

		if nil == err && result > 0 {
			openUser.UserId = user.Id
			c.SetSession("openUser", openUser)
		}
		return
	}

	c.StringError(exception.USER_NAME_OR_PASS_UNMATCH.Error())

	c.RecordLoginFailTimes()

	c.OauthLogin()

}