What is the general approach on Login/Register Forms Presentation

So I am not sure which option is better for the User, to have a Modal Open when the User clicks on a Login/Register Button on the Navbar or if an external Page is the better approach?

Because often I see redirects to other pages but I feel like the User Flow is better if he logs in right on the page where he needs permissions and can then instantly continue his work without getting redirected x times.