Exemplo n.º 1
0
func ChangePassword(rw http.ResponseWriter, r *http.Request, enc encoding.Encoder, dtx *apicontext.DataContext) string {
	user := customer.CustomerUser{
		Email: r.FormValue("email"),
	}

	oldPass := r.FormValue("oldPass")
	newPass := r.FormValue("newPass")

	if err := user.ChangePass(oldPass, newPass, dtx); err != nil {
		apierror.GenerateError("Could not change password: "******""
	}

	return encoding.Must(enc.Encode("Success"))
}