How To Send A User Back to the Page They Came From After Login

When the user hits the article limit, he is prompter to login. But this login sends the user to the profile page, or home page, but not the page they came from. Here’s a snippet that will send the user back to the page they were on when they clicked the login link.