code: func (api UsersAPI) UpdatePassword(w http.ResponseWriter, r *http.Request) {
  	username := mux.Vars(r)["username"]
  	body := struct {
  		Currentpassword string `json:"currentpassword"`
  		Newpassword     string `json:"newpassword"`
  	}{}
  	if err := json.NewDecoder(r.Body).Decode(&body); err != nil {
  		http.Error(w, http.StatusText(http.StatusBadRequest), http.StatusBadRequest)
  		return
  	}
  	userMgr := user.NewManager(r)
  	exists, err := userMgr.Exists(username)
  	if !exists || err != nil {
  		http.Error(w, http.StatusText(http.StatusNotFound), http.StatusNotFound)
  		return
  	}
  	passwordMgr := password.NewManager(r)
  	passwordok, err := passwordMgr.Validate(username, body.Currentpassword)
  	if err != nil {
  		log.Error(err)
  		http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)
  		return
  	}
  	if !passwordok {
  		writeErrorResponse(w, 422, "incorrect_password")
  		return
  	}
  	err = passwordMgr.Save(username, body.Newpassword)
  	if err != nil {
  		writeErrorResponse(w, 422, err.Error())
  		return
  	}
  	w.WriteHeader(http.StatusNoContent)
  }
docs: // UpdatePassword is the handler for PUT /users/{username}/password