Epoxy resin or cyanocrylate (to glue both parts together)
Recomendations:
Before you start gluying everything down, make sure the magnets are in the right position. I recommend using some tape to hold them in place and checking with a magnet if they stick in the same position.