func userUpdatePasswordHandler(userDao UserDao, lobby Lobby, log log.Logger) http.HandlerFunc {
	return func(w http.ResponseWriter, r *http.Request) {
		username := r.FormValue("username")
		password := r.FormValue("password")
		newPassword := r.FormValue("password_confirm")
		u, err := user.New(username, password)
		if err != nil {
			writeInternalError(err, log, w)
			return
		}
		ctx := r.Context()
		if err := userDao.UpdatePassword(ctx, *u, newPassword); err != nil {
			handleUserDaoError(w, err, "update password", log)
			return
		}
		lobby.RemoveUser(username)
	}
}
// userUpdatePasswordHandler updates the user's password.
userUpdatePasswordHandler updates the user's password.
// userUpdatePasswordHandler updates the user ' s password .
func userUpdatePasswordHandler(userDao UserDao, lobby Lobby, log log.Logger) http.HandlerFunc {
	return func(w http.ResponseWriter, r *http.Request) {
		username := r.FormValue("username")
		password := r.FormValue("password")
		newPassword := r.FormValue("password_confirm")
		u, err := user.New(username, password)
		if err != nil {
			writeInternalError(err, log, w)
			return
		}
		ctx := r.Context()
		if err := userDao.UpdatePassword(ctx, *u, newPassword); err != nil {
			handleUserDaoError(w, err, "update password", log)
			return
		}
		lobby.RemoveUser(username)
	}
}
func userUpdatePasswordHandler ( userDao UserDao , lobby Lobby , log log . Logger ) http . HandlerFunc { return func ( w http . ResponseWriter , r * http . Request ) { username := r . FormValue ( " " ) password := r . FormValue ( " " ) newPassword := r . FormValue ( " " ) u , err := user . New ( username , password ) if err != nil { writeInternalError ( err , log , w ) return } ctx := r . Context ( ) if err := userDao . UpdatePassword ( ctx , * u , newPassword ) ; err != nil { handleUserDaoError ( w , err , " " , log ) return } lobby . RemoveUser ( username ) } }
userUpdatePasswordHandler updates the user's password.
userUpdatePasswordHandler updates the user ' s password .