Hello again.
You probably deleted more than you should have...
This is standard behavior you see under the Common UI Flow. I picked a random project and copied from there.
1. You save the URL in session before going to login page.

2. After a successful login, you go to the saved URL.
3. Done.
Easy, right?