Exemple #1
0
// Reset implemented user password reset.
func (this *ResetRouter) Post() {
	code := this.GetString(":code")
	this.Data["Code"] = code

	var user models.User

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

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

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

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

	} else {
		this.Data["Success"] = false
	}

	this.Render("auth/reset.html", this.Data)
}
Exemple #2
0
// Reset implemented user password reset.
func (this *ResetRouter) Get() {
	code := this.GetString(":code")
	this.Data["Code"] = code

	var user models.User

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