RIS-Assisted Joint Preamble Detection and Localization