Beispiel #1
0
func setPasswordHandler(r *http.Request, w http.ResponseWriter,
	user *models.Account, p Parameter) {
	form := p.(setPasswordForm)

	if user.Password != Md5(form.Old) {
		writeResponse(r.RequestURI, w, nil, errors.NewError(errors.PasswordError, "原密码错误"))
		return
	}

	err := user.SetPassword(Md5(form.New))
	writeResponse(r.RequestURI, w, nil, err)
}