Exemplo n.º 1
0
// Reset implemented user password reset.
func (this *ForgotRouter) ResetPost() {
	this.TplNames = "auth/reset.html"

	code := this.GetString(":code")
	this.Data["Code"] = code

	var user models.User

	if models.VerifyUserResetPwdCode(&user, code) {
		this.Data["Success"] = true

		form := models.ResetPwdForm{}
		if this.ValidFormSets(&form) == false {
			return
		}

		user.IsActive = true
		user.Rands = models.GetUserSalt()

		if err := models.SaveNewPassword(&user, form.Password); err != nil {
			beego.Error("ResetPost Save New Password: "******"/login", 302, "ResetSuccess")

	} else {
		this.Data["Success"] = false
	}
}
Exemplo n.º 2
0
// Reset implemented user password reset.
func (this *ForgotRouter) Reset() {
	this.TplNames = "auth/reset.html"

	code := this.GetString(":code")
	this.Data["Code"] = code

	var user models.User

	if models.VerifyUserResetPwdCode(&user, code) {
		this.Data["Success"] = true
		form := models.ResetPwdForm{}
		this.SetFormSets(&form)
	} else {
		this.Data["Success"] = false
	}
}