The German parliament has passed a motion to tighten migration rules after a deadly attack by a rejected asylum-seeker.