MUSLIM 1-2:
from ʿUmar b. al-Khaṭṭāb —
the Messenger of Allah ﷺ said, "Deeds are ˹judged based˺ by ˹their˺ intention, and a person ˹is granted the due˺ for what they intended. So whoever had emigrated ˹for the sake of˺ Allah and His Messenger then his emigration is ˹earned for the sake of˺ Allah and His Messenger; and whoever had emigrated for ˹the sake of˺ worldly benefits or for ˹the sake of˺ marrying a woman, the ˹due˺ of his emigration ˹is earned˺ for what he emigrated for."
خمسون ابن رجب ١-٢:
عن عمر بن الخطاب —
قَالَ رَسُولُ اللَّهِ ﷺ «إِنَّمَا الأَعْمَالُ بِالنِّيَّةِ وَإِنَّمَا لاِمْرِئٍ مَا نَوَى۔ فَمَنْ كَانَتْ هِجْرَتُهُ إِلَى اللَّهِ وَرَسُولِهِ، فَهِجْرَتُهُ إِلَى اللَّهِ وَرَسُولِهِ؛ وَمَنْ كَانَتْ هِجْرَتُهُ لِدُنْيَا يُصِيبُهَا أَوِ امْرَأَةٍ يَتَزَوَّجُهَا، فَهِجْرَتُهُ إِلَى مَا هَاجَرَ إِلَيْهِ۔»
hadithunlocked.com